E - The type of the archive entries.@Immutable @DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public abstract class FsArchiveDriver<E extends FsArchiveEntry> extends FsDriver
| Constructor and Description |
|---|
FsArchiveDriver() |
| Modifier and Type | Method and Description |
|---|---|
Icon |
getClosedIcon(FsModel model)
Returns the icon that should be displayed for the given archive file
if it's closed/collapsed in the view.
|
InputSocket<?> |
getInputSocket(FsController<?> controller,
FsEntryName name,
BitField<FsInputOption> options)
Called to prepare reading an archive file artifact of this driver from
name in controller using options. |
Icon |
getOpenIcon(FsModel model)
Returns the icon that should be displayed for the given archive file
if it's open/expanded in the view.
|
OutputSocket<?> |
getOutputSocket(FsController<?> controller,
FsEntryName name,
BitField<FsOutputOption> options,
Entry template)
Called to prepare writing an archive file artifact of this driver to
name in controller using options and template. |
protected abstract IOPool<?> |
getPool()
Returns the I/O pool to use for allocating temporary I/O entries.
|
boolean |
isFederated()
Returns
true iff this file system driver implements a federated
file system type, i.e. if the type of file system must be a member of a
parent file system. |
FsController<?> |
newController(FsModel model,
FsController<?> parent)
Returns a new thread-safe file system controller for the given mount
point and parent file system controller.
|
E |
newEntry(String name,
Entry.Type type,
Entry template)
Equivalent to
newEntry(name, type, template, NO_OUTPUT_OPTION). |
abstract E |
newEntry(String name,
Entry.Type type,
Entry template,
BitField<FsOutputOption> mknod)
Returns a new archive entry for the given name.
|
abstract InputShop<E> |
newInputShop(FsModel model,
InputSocket<?> input)
Creates a new input shop for reading the archive entries for the
given
model from the given input socket's target. |
protected static InputStream |
newInputStream(FsModel model,
InputSocket<?> input)
Returns an input stream obtained from the given socket and wraps a
plain
IOException in a FileNotFoundException unless
it's an FsException. |
abstract OutputShop<E> |
newOutputShop(FsModel model,
OutputSocket<?> output,
InputShop<E> source)
Creates a new output shop for writing archive entries for the
given
model to the given output socket's target. |
protected static OutputStream |
newOutputStream(FsModel model,
OutputSocket<?> output)
Returns an output stream obtained from the given socket and wraps a
plain
IOException in a FileNotFoundException unless
it's an FsException. |
protected static ReadOnlyFile |
newReadOnlyFile(FsModel model,
InputSocket<?> input)
Returns a read only file obtained from the given socket and wraps a
plain
IOException in a FileNotFoundException unless
it's an FsException. |
getPriority, toStringpublic final boolean isFederated()
true iff this file system driver implements a federated
file system type, i.e. if the type of file system must be a member of a
parent file system.
The implementation in the class FsDriver returns false.
The implementation in the class FsArchiveDriver always returns
true.
This can't get overridden.
isFederated in class FsDrivertrue iff the type of the file system implemented by this
file system driver is federated, i.e. must be a member of a
parent file system.protected abstract IOPool<?> getPool()
@CheckForNull public Icon getOpenIcon(FsModel model)
The implementation in the abstract class FsArchiveDriver simply
returns null.
model - the file system model.null is returned, a default icon should be displayed.@CheckForNull public Icon getClosedIcon(FsModel model)
The implementation in the abstract class FsArchiveDriver simply
returns null.
model - the file system model.null is returned, a default icon should be displayed.public InputSocket<?> getInputSocket(FsController<?> controller, FsEntryName name, BitField<FsInputOption> options)
name in controller using options.
This method should be overridden in order to modify the given options
before forwarding the call to the given controller.
The implementation in the class FsArchiveDriver simply forwards
the call to the given controller with the given options unaltered.
controller - the controller to use for reading an artifact of this
driver.name - the entry name.options - the options to use.public OutputSocket<?> getOutputSocket(FsController<?> controller, FsEntryName name, BitField<FsOutputOption> options, @CheckForNull Entry template)
name in controller using options and template.
This method should be overridden in order to modify the given options
before forwarding the call to the given controller.
The implementation in the class FsArchiveDriver simply forwards
the call to the given controller with the given options unaltered.
controller - the controller to use for writing an artifact of this
driver.name - the entry name.options - the options to use.template - the template to use.public FsController<?> newController(FsModel model, FsController<?> parent)
When called, the following expression is a precondition:
mountPoint.getParent().equals(parent.getModel().getMountPoint())
Note that an archive file system is always federated and therefore
its parent file system controller is never null.
Furthermore, an archive driver implementation is not expected to consider the scheme of the given mount point to determine the class of the returned file system controller. Consequently, it is an error to call this method with a mount point which has a scheme which is not supported by this archive driver.
Note again that the returned file system controller must be thread-safe!
newController in class FsDrivermodel - the file system model.parent - the nullable parent file system controller.public abstract InputShop<E> newInputShop(FsModel model, InputSocket<?> input) throws IOException
model from the given input socket's target.model - the file system model.input - the input socket for reading the contents of the archive
from its target.FileNotFoundException - if the target archive file does not exist
or is (temporarily) not accessible.
An exception of this type marks a transient cause,
i.e. this method may get subsequently called until it succeeds.IOException - if the target archive file is a
false positive archive file.
An exception of this type marks a persistent cause,
i.e. this method will not get called again until the archive
file system is synchronized with its parent file system.protected static ReadOnlyFile newReadOnlyFile(FsModel model, InputSocket<?> input) throws FsException, FileNotFoundException
IOException in a FileNotFoundException unless
it's an FsException.
This method is useful for driver implementations to ensure that an
expection from opening a socket is not recognized as a false
positive archive file.model - the file system model.input - the input socketFsException - at the discretion of the socket.FileNotFoundException - on any I/O error.protected static InputStream newInputStream(FsModel model, InputSocket<?> input) throws FsException, FileNotFoundException
IOException in a FileNotFoundException unless
it's an FsException.
This method is useful for driver implementations to ensure that an
expection from opening a socket is not recognized as a false
positive archive file.model - the file system model.input - the input socketFsException - at the discretion of the socket.FileNotFoundException - on any I/O error.public abstract OutputShop<E> newOutputShop(FsModel model, OutputSocket<?> output, @CheckForNull InputShop<E> source) throws IOException
model to the given output socket's target.model - the file system model.output - the output socket for writing the contents of the
archive to its target.source - the InputShop if archive is going to get
updated.
If not null, this is guaranteed to be a product
of this driver's newInputShop(de.schlichtherle.truezip.fs.FsModel, de.schlichtherle.truezip.socket.InputSocket<?>) factory method, which 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.FileNotFoundException - if the target archive file does not exist
or is (temporarily) not accessible.
An exception of this type marks a transient cause,
i.e. this method may get subsequently called until it succeeds.IOException - if the target archive file is a
false positive archive file.
An exception of this type marks a persistent cause,
i.e. this method will not get called again until the archive
file system is synchronized with its parent file system.protected static OutputStream newOutputStream(FsModel model, OutputSocket<?> output) throws FsException, FileNotFoundException
IOException in a FileNotFoundException unless
it's an FsException.
This method is useful for driver implementations to ensure that an
expection from opening a socket is not recognized as a false
positive archive file.model - the file system model.output - the output socketFsException - at the discretion of the socket.FileNotFoundException - on any I/O error.public final E newEntry(String name, Entry.Type type, @CheckForNull Entry template) throws CharConversionException
newEntry(name, type, template, NO_OUTPUT_OPTION).CharConversionExceptionpublic abstract E newEntry(String name, Entry.Type type, @CheckForNull Entry template, BitField<FsOutputOption> mknod) throws CharConversionException
entry name for their
particular requirements.
If template is not null, then the returned entry shall
inherit as much properties from this template as possible - with the
exception of its name and type.
Furthermore, if name and type are equal to the name and
type of this template, then the returned entry shall be a (deep) clone
of the template which shares no mutable objects with the template.
name - an entry name.type - an entry type.template - if not null, then the new entry shall inherit
as much properties from this entry as possible - with the
exception of its name and type.mknod - when called from FsArchiveController.mknod(de.schlichtherle.truezip.fs.FsEntryName, de.schlichtherle.truezip.entry.Entry.Type, de.schlichtherle.truezip.util.BitField<de.schlichtherle.truezip.fs.FsOutputOption>, de.schlichtherle.truezip.entry.Entry), this
is its options parameter, otherwise it's typically an
empty set.CharConversionException - if name contains characters
which are invalid.Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.