|
TrueZIP 6.8.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ArchiveDriver
This "driver" interface is used in a Builder software pattern as the
Builder or Abstract Factory which reads and writes archives of a
particular type, e.g. ZIP, TZP, JAR, TAR, TAR.GZ, TAR.BZ2 or any other.
Archive drivers may be shared by multiple instances of
ArchiveController and
ArchiveDetector.
The following requirements must be met by any implementation:
File may seem to
behave non-deterministic and may even throw exceptions where it
shouldn't.
DefaultArchiveDetector,
a no-arguments constructor must be provided.
Serializable interface,
too, so that File instances which are
indirectly referring to it can be serialized.
| 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. |
OutputArchive |
createOutputArchive(Archive archive,
OutputStream out,
InputArchive source)
Creates a new output archive for archive
from the given output stream. |
boolean |
equals(Object o)
Archive drivers will be put into hash maps as keys, so be sure to implement this properly. |
Icon |
getClosedIcon(Archive archive)
Returns the icon that FileSystemView
and FileTreeCellRenderer should
display for the given archive. |
Icon |
getOpenIcon(Archive archive)
Returns the icon that FileTreeCellRenderer
should display for the given archive. |
int |
hashCode()
Archive drivers will be put into hash maps as keys, so be sure to implement this properly. |
| Method Detail |
|---|
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) |
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
ArchiveEntry createArchiveEntry(Archive archive,
String entryName,
ArchiveEntry template)
throws CharConversionException
entryName
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.
OutputArchive createOutputArchive(Archive archive,
OutputStream out,
InputArchive source)
throws IOException
archive
from the given output stream.
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 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.OutputArchiveIcon getOpenIcon(Archive archive)
FileTreeCellRenderer
should display for the given archive.
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.
null is returned, a default icon should be used.Icon getClosedIcon(Archive archive)
FileSystemView
and FileTreeCellRenderer should
display for the given archive.
archive - The abstract archive representation which TrueZIP's
internal ArchiveController is processing
- never null.
null is returned, a default icon should be used.boolean equals(Object o)
Object.equals(java.lang.Object) and the best possible implementation is the
default implementation in Object which is most
discriminating.
equals in class Objectint hashCode()
Object.hashCode() and the best possible implementation is the
default implementation in Object which is most
discriminating.
hashCode in class Object
|
TrueZIP 6.8.1 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||