|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.schlichtherle.io.archive.spi.AbstractArchiveDriver
de.schlichtherle.io.archive.tar.TarDriver
public class TarDriver
An archive driver which builds TAR files.
Instances of this class are immutable.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class de.schlichtherle.io.archive.spi.AbstractArchiveDriver |
|---|
AbstractArchiveDriver.InconsistentCharsetSupportError |
| Field Summary | |
|---|---|
static String |
DEFAULT_CHARSET
The character set to use for entry names, which is "US-ASCII". |
| Constructor Summary | |
|---|---|
TarDriver()
Equivalent to this(DEFAULT_CHARSET, null, null). |
|
TarDriver(String charset)
Equivalent to this(charset, null, null). |
|
TarDriver(String charset,
Icon openIcon,
Icon closedIcon)
Constructs a new TAR driver. |
|
| Method Summary | |
|---|---|
ArchiveEntry |
createArchiveEntry(Archive archive,
String entryName,
ArchiveEntry template)
Creates a new archive entry for entryName
for use with an OutputArchive. |
InputArchive |
createInputArchive(Archive archive,
ReadOnlyFile rof)
Creates a new input archive for archive
from the given read only file. |
protected InputStream |
createInputStream(Archive archive,
ReadOnlyFile rof)
Returns a new InputStream to read the contents from the
given ReadOnlyFile from. |
OutputArchive |
createOutputArchive(Archive archive,
OutputStream out,
InputArchive source)
Creates a new output archive for archive
from the given output stream. |
protected TarInputArchive |
createTarInputArchive(Archive archive,
InputStream in)
Returns a new TarInputArchive to read the contents from
the given InputStream. |
protected TarOutputArchive |
createTarOutputArchive(Archive archive,
OutputStream out,
TarInputArchive source)
|
| Methods inherited from class de.schlichtherle.io.archive.spi.AbstractArchiveDriver |
|---|
ensureEncodable, getCharset, getClosedIcon, getEncoding, getOpenIcon |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.schlichtherle.io.archive.spi.ArchiveDriver |
|---|
equals, hashCode |
| Field Detail |
|---|
public static final String DEFAULT_CHARSET
| Constructor Detail |
|---|
public TarDriver()
this(DEFAULT_CHARSET, null, null).
public TarDriver(String charset)
this(charset, null, null).
public TarDriver(String charset,
Icon openIcon,
Icon closedIcon)
charset - The name of a character set to use for all entry names
when reading or writing TAR files.
Warning: Due to limitations in Apache's Ant code, using
anything else than "US-ASCII" is currently not
supported!| Method Detail |
|---|
public ArchiveEntry createArchiveEntry(Archive archive,
String entryName,
ArchiveEntry template)
throws CharConversionException
ArchiveDriverentryName
for use with an OutputArchive.
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.entryName - A valid archive entry name - never null.template - If not null, then the newly created entry
shall inherit as much attributes from this object as possible
(with the exception of the name).
This is typically used for archive copy operations.
Note that there is no guarantee on the runtime type of this
object; it may have been created by other drivers.
It is safe to ignore the metaData property when
copying entries.
CharConversionException - If name contains
illegal characters.
public InputArchive createInputArchive(Archive archive,
ReadOnlyFile rof)
throws IOException
archive
from the given read only file.
Note that if an exception is thrown, the method must be reentrant!
In addition, the exception type determines the behaviour of the classes
File, FileInputStream and FileOutputStream
as follows:
| Exception type | File.isFile() |
File.isDirectory() |
File.exists() |
File.delete() |
|---|---|---|---|---|
FileNotFoundException |
false |
false |
true |
true (unless prohibited by the real file system) |
IOException |
true |
false |
true |
true (unless prohibited by the real file system) |
This implementation calls createInputStream(archive, rof) and passes the resulting stream to
createTarInputArchive(Archive, InputStream).
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.rof - The ReadOnlyFile to read the
actual archive contents from - never null.
Hint: If you'ld prefer to have an InputStream,
you could decorate this parameter with a
ReadOnlyFileInputStream.
TransientIOException - If calling this method for the same
archive file again may finally succeed.
This exception is associated with another IOException
as its cause which is unwrapped and interpreted as below.
FileNotFoundException - If the input archive is inaccessible
for any reason and you would like the package
de.schlichtherle.io to mask the archive as a
special file which cannot get read, written or deleted.
IOException - On any other I/O or data format related issue
when reading the input archive and you would like the package
de.schlichtherle.io to treat the archive like a
regular file which may be read, written or deleted.InputArchive
protected InputStream createInputStream(Archive archive,
ReadOnlyFile rof)
throws IOException
InputStream to read the contents from the
given ReadOnlyFile from.
Override this method in order to decorate the stream returned by the
implementation in this class in order to have the driver read the TAR
file from wrapper file formats such as GZIP or BZIP2.
Note that the returned stream should support marking for best
performance and will always be closed early by
createInputArchive(Archive, ReadOnlyFile).
IOException
protected TarInputArchive createTarInputArchive(Archive archive,
InputStream in)
throws IOException
TarInputArchive to read the contents from
the given InputStream.
The implementation in this class simply returns
new TarInputArchive(in).
IOException
public OutputArchive createOutputArchive(Archive archive,
OutputStream out,
InputArchive source)
throws IOException
archive
from the given output stream.
This implementation forwards the call to createTarOutputArchive(de.schlichtherle.io.archive.Archive, java.io.OutputStream, de.schlichtherle.io.archive.tar.TarInputArchive)
and wraps the result in a new MultiplexedOutputArchive.
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.out - The OutputStream to write the archive entries to
- never null.source - The source InputArchive if
archive is going to get updated.
If not null, this is guaranteed to be a product
of this driver's ArchiveDriver.createInputArchive(de.schlichtherle.io.archive.Archive, de.schlichtherle.io.rof.ReadOnlyFile) method.
This may be used to copy some meta data which is specific to
the type of archive this driver supports.
For example, this could be used to copy the comment of a ZIP
file.
TransientIOException - If calling this method for the same
archive file again may finally succeed.
This exception is associated with another IOException
as its cause which is unwrapped and interpreted as below.
FileNotFoundException - If the output archive is inaccessible
for any reason.
IOException - On any other I/O or data format related issue
when writing the output archive.OutputArchive
protected TarOutputArchive createTarOutputArchive(Archive archive,
OutputStream out,
TarInputArchive source)
throws IOException
IOException
|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||