|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ice.tar.TarArchive
The TarArchive class implements the concept of a tar archive. A tar archive is a series of entries, each of which represents a file system object. Each entry in the archive consists of a header record. Directory entries consist only of the header record, and are followed by entries for the directory's contents. File entries consist of a header record followed by the number of records needed to contain the file's contents. All entries are written on record boundaries. Records are 512 bytes long. TarArchives are instantiated in either read or write mode, based upon whether they are instantiated with an InputStream or an OutputStream. Once instantiated TarArchives read/write mode can not be changed. There is currently no support for random access to tar archives. However, it seems that subclassing TarArchive, and using the TarBuffer.getCurrentRecordNum() and TarBuffer.getCurrentBlockNum() methods, this would be rather trvial.
TarBuffer
,
TarHeader
,
TarEntry
Field Summary | |
protected boolean |
asciiTranslate
|
protected boolean |
debug
|
protected int |
groupId
|
protected String |
groupName
|
protected boolean |
keepOldFiles
|
protected String |
pathPrefix
|
protected TarProgressDisplay |
progressDisplay
|
protected byte[] |
recordBuf
|
protected int |
recordSize
|
protected String |
rootPath
|
protected TarInputStream |
tarIn
|
protected TarOutputStream |
tarOut
|
protected String |
tempPath
|
protected TarTransFileTyper |
transTyper
|
protected int |
userId
|
protected String |
userName
|
protected boolean |
verbose
|
Constructor Summary | |
TarArchive(InputStream inStream)
The InputStream based constructors create a TarArchive for the purposes of e'x'tracting or lis't'ing a tar archive. |
|
TarArchive(InputStream inStream,
int blockSize)
|
|
TarArchive(InputStream inStream,
int blockSize,
int recordSize)
|
|
TarArchive(OutputStream outStream)
The OutputStream based constructors create a TarArchive for the purposes of 'c'reating a tar archive. |
|
TarArchive(OutputStream outStream,
int blockSize)
|
|
TarArchive(OutputStream outStream,
int blockSize,
int recordSize)
|
Method Summary | |
void |
closeArchive()
Close the archive. |
void |
extractContents(File destDir)
Perform the "extract" command and extract the contents of the archive. |
int |
getGroupId()
Get the group id being used for archive entry headers. |
String |
getGroupName()
Get the group name being used for archive entry headers. |
int |
getRecordSize()
Get the archive's record size. |
String |
getTempDirectory()
Get the current temporary directory path. |
int |
getUserId()
Get the user id being used for archive entry headers. |
String |
getUserName()
Get the user name being used for archive entry headers. |
boolean |
isVerbose()
Returns the verbosity setting. |
void |
listContents()
Perform the "list" command and list the contents of the archive. |
void |
setAsciiTranslation(boolean asciiTranslate)
Set the ascii file translation flag. |
void |
setDebug(boolean debugF)
Set the debugging flag. |
void |
setKeepOldFiles(boolean keepOldFiles)
Set the flag that determines whether existing files are kept, or overwritten during extraction. |
void |
setTarProgressDisplay(TarProgressDisplay display)
Set the current progress display interface. |
void |
setTempDirectory(String path)
Set the current temporary directory path. |
void |
setTransFileTyper(TarTransFileTyper transTyper)
Set the object that will determine if a file is of type ascii text for translation purposes. |
void |
setUserInfo(int userId,
String userName,
int groupId,
String groupName)
Set user and group information that will be used to fill in the tar archive's entry headers. |
void |
setVerbose(boolean verbose)
Set the verbosity flag. |
void |
writeEntry(TarEntry oldEntry,
boolean recurse)
Write an entry to the archive. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean verbose
protected boolean debug
protected boolean keepOldFiles
protected boolean asciiTranslate
protected int userId
protected String userName
protected int groupId
protected String groupName
protected String rootPath
protected String tempPath
protected String pathPrefix
protected int recordSize
protected byte[] recordBuf
protected TarInputStream tarIn
protected TarOutputStream tarOut
protected TarTransFileTyper transTyper
protected TarProgressDisplay progressDisplay
Constructor Detail |
public TarArchive(InputStream inStream)
public TarArchive(InputStream inStream, int blockSize)
public TarArchive(InputStream inStream, int blockSize, int recordSize)
public TarArchive(OutputStream outStream)
public TarArchive(OutputStream outStream, int blockSize)
public TarArchive(OutputStream outStream, int blockSize, int recordSize)
Method Detail |
public void setDebug(boolean debugF)
debugF
- The new debug setting.public boolean isVerbose()
public void setVerbose(boolean verbose)
verbose
- The new verbosity setting.public void setTarProgressDisplay(TarProgressDisplay display)
display
- The new progress display interface.TarProgressDisplay
public void setKeepOldFiles(boolean keepOldFiles)
keepOldFiles
- If true, do not overwrite existing files.public void setAsciiTranslation(boolean asciiTranslate)
asciiTranslate
- If true, translate ascii text files.public void setTransFileTyper(TarTransFileTyper transTyper)
transTyper
- The new TransFileTyper object.public void setUserInfo(int userId, String userName, int groupId, String groupName)
userId
- The user Id to use in the headers.userName
- The user name to use in the headers.groupId
- The group id to use in the headers.groupName
- The group name to use in the headers.public int getUserId()
public String getUserName()
public int getGroupId()
public String getGroupName()
public String getTempDirectory()
public void setTempDirectory(String path)
path
- The new temporary directory path.public int getRecordSize()
public void closeArchive() throws IOException
public void listContents() throws IOException, InvalidHeaderException
public void extractContents(File destDir) throws IOException, InvalidHeaderException
destDir
- The destination directory into which to extract.public void writeEntry(TarEntry oldEntry, boolean recurse) throws IOException
entry
- The TarEntry representing the entry to write to the archive.recurse
- If true, process the children of directory entries.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |