E
- the type of the archive entries.@Immutable public abstract class FsArchiveDriver<E extends FsArchiveEntry> extends FsDriver
Subclasses should be immutable.
Constructor and Description |
---|
FsArchiveDriver() |
Modifier and Type | Method and Description |
---|---|
void |
checkEncodable(String name)
Ensures that the given entry name can get encoded by this driver's
character set.
|
FsController |
decorate(FsController controller)
Decorates the given file system controller.
|
abstract Charset |
getCharset()
Returns the character set to use for encoding character based meta data
such as entry names or file comments to binary data when writing
an archive file.
|
abstract net.java.truecommons.cio.IoBufferPool |
getPool()
Returns the pool for allocating temporary I/O buffers.
|
boolean |
getRedundantContentSupport()
Returns
true if and only if the archive files produced by this
archive driver may contain redundant archive entry contents. |
boolean |
getRedundantMetaDataSupport()
Returns
true if and only if the archive files produced by this
archive driver may contain redundant archive entry meta data. |
boolean |
isArchiveDriver()
Returns
true if and only if this is an archive driver, that is,
if file systems of this type must be a member of a parent file system. |
FsController |
newController(FsManager context,
FsModel model,
FsController parent)
Returns a new file system controller for the mount point of the
given file system model.
|
abstract E |
newEntry(net.java.truecommons.shed.BitField<FsAccessOption> options,
String name,
net.java.truecommons.cio.Entry.Type type,
net.java.truecommons.cio.Entry template)
Returns a new entry for the given name.
|
E |
newEntry(String name,
net.java.truecommons.cio.Entry.Type type,
net.java.truecommons.cio.Entry template)
Equivalent to
newEntry(FsAccessOptions.NONE, name, type, template) . |
net.java.truecommons.cio.InputService<E> |
newInput(FsModel model,
net.java.truecommons.shed.BitField<FsAccessOption> options,
FsController controller,
FsNodeName name)
This method gets called by an archive controller in order to create a
new input service for its target archive file.
|
protected abstract net.java.truecommons.cio.InputService<E> |
newInput(FsModel model,
FsInputSocketSource source)
Creates a new input service for reading archive entries for the given
model from the target archive file referenced by source . |
net.java.truecommons.cio.OutputService<E> |
newOutput(FsModel model,
net.java.truecommons.shed.BitField<FsAccessOption> options,
FsController controller,
FsNodeName name,
net.java.truecommons.cio.InputService<E> input)
This method gets called by an archive controller in order to create a
new output service for its target archive file.
|
protected abstract net.java.truecommons.cio.OutputService<E> |
newOutput(FsModel model,
FsOutputSocketSink sink,
net.java.truecommons.cio.InputService<E> input)
Creates a new input service for writing archive entries for the given
model to the target archive file referenced by sink . |
static String |
normalize(String name,
net.java.truecommons.cio.Entry.Type type)
Normalizes the given entry name so that it forms a valid entry name for
ZIP and TAR files by ensuring that the returned entry name ends with the
separator character
'/' if and only if type is
DIRECTORY . |
protected FsOutputSocketSink |
sink(net.java.truecommons.shed.BitField<FsAccessOption> options,
FsController controller,
FsNodeName name)
Called to prepare writing an archive file artifact of this driver to
the node
name in controller using options and
the nullable template . |
protected FsInputSocketSource |
source(net.java.truecommons.shed.BitField<FsAccessOption> options,
FsController controller,
FsNodeName name)
Called to prepare reading an archive file artifact of this driver from
name in controller using options . |
String |
toString()
Returns a string representation of this object for debugging and logging
purposes.
|
public final void checkEncodable(String name) throws CharConversionException
name
- an entry name.CharConversionException
- If the entry name contains characters
which cannot get encoded.public FsController decorate(FsController controller)
controller
- the file system controller to decorate.FsArchiveDriver
unconditionally returns controller
.public abstract Charset getCharset()
This is an immutable property - multiple calls must return the same object.
public abstract net.java.truecommons.cio.IoBufferPool getPool()
This is an immutable property - multiple calls must return the same object.
public boolean getRedundantContentSupport()
true
if and only if the archive files produced by this
archive driver may contain redundant archive entry contents.
If the return value is true
, then an archive file may contain
redundant archive entry contents, but only the last contents written
should get used when reading the archive file.
This is an immutable property - multiple calls must return the same value.
The default value of this property is false
as defined by the
implementation in the class FsArchiveDriver
.
true
if and only if the archive files produced by this
archive driver may contain redundant archive entry contents.public boolean getRedundantMetaDataSupport()
true
if and only if the archive files produced by this
archive driver may contain redundant archive entry meta data.
If the return value is true
, then an archive file may contain
redundant archive entry meta data, but only the last meta data written
should get used when reading the archive file.
This usually implies the existence of a central directory in the
resulting archive file.
This is an immutable property - multiple calls must return the same value.
The default value of this property is false
as defined by the
implementation in the class FsArchiveDriver
.
true
if and only if the archive files produced by this
archive driver may contain redundant archive entry meta data.public final boolean isArchiveDriver()
true
if and only if this is an archive driver, that is,
if file systems of this type must be a member of a parent file system.isArchiveDriver
in class FsDriver
FsArchiveDriver
unconditionally returns true
.public final FsController newController(FsManager context, FsModel model, @Nonnull FsController parent)
When called, you may assert the following precondition:
assert null == parent
? null == model.getParent()
: parent.getModel().equals(model.getParent())
The implementation in the class FsArchiveDriver
forwards the
call to the given file system manager.
context
- the calling context.model
- the file system model.parent
- the nullable parent file system controller.public abstract E newEntry(net.java.truecommons.shed.BitField<FsAccessOption> options, String name, net.java.truecommons.cio.Entry.Type type, @CheckForNull net.java.truecommons.cio.Entry template)
entry name
for their particular requirements.options
- when called from FsController.make(net.java.truecommons.shed.BitField<net.java.truevfs.kernel.spec.FsAccessOption>, net.java.truevfs.kernel.spec.FsNodeName, net.java.truecommons.cio.Entry.Type, net.java.truecommons.cio.Entry)
, this is its
options
parameter, otherwise it's typically an empty set.name
- the entry name.type
- the 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.newEntry(String, Entry.Type, Entry)
public final E newEntry(String name, net.java.truecommons.cio.Entry.Type type, @CheckForNull net.java.truecommons.cio.Entry template)
newEntry(FsAccessOptions.NONE, name, type, template)
.name
- the entry name.type
- the 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.@CreatesObligation public net.java.truecommons.cio.InputService<E> newInput(FsModel model, net.java.truecommons.shed.BitField<FsAccessOption> options, FsController controller, FsNodeName name) throws IOException
The implementation in FsArchiveDriver
simply forwards the call
to source(net.java.truecommons.shed.BitField<net.java.truevfs.kernel.spec.FsAccessOption>, net.java.truevfs.kernel.spec.FsController, net.java.truevfs.kernel.spec.FsNodeName)
and newInput(FsModel, FsInputSocketSource)
.
model
- the file system model for the target archive file.options
- the options for accessing the target archive file in the
parent file system.controller
- the controller for the parent file system with the
target archive file.name
- the node name of the target archive file in the parent
file system.IOException
- on any I/O error.
If the file system node for the given model exists in the
parent file system and is not a Entry.Type.SPECIAL
type, then this exception is deemed to indicate a
persistent false positive archive file and gets cached
until the file system controller for the given model gets
synced again.
Otherwise, this exception is deemed to indicate a
transient false positive archive file and does not
get cached.@CreatesObligation protected abstract net.java.truecommons.cio.InputService<E> newInput(FsModel model, FsInputSocketSource source) throws IOException
model
from the target archive file referenced by source
.model
- the file system model.source
- the source for reading the target archive file.IOException
- on any I/O error.newInput(FsModel, BitField, FsController, FsNodeName)
@CreatesObligation public net.java.truecommons.cio.OutputService<E> newOutput(FsModel model, net.java.truecommons.shed.BitField<FsAccessOption> options, FsController controller, FsNodeName name, @CheckForNull @WillNotClose net.java.truecommons.cio.InputService<E> input) throws IOException
The implementation in FsArchiveDriver
simply forwards the call
to sink(net.java.truecommons.shed.BitField<net.java.truevfs.kernel.spec.FsAccessOption>, net.java.truevfs.kernel.spec.FsController, net.java.truevfs.kernel.spec.FsNodeName)
and newOutput(FsModel, FsOutputSocketSink, InputService)
.
model
- the file system model for the target archive file.options
- the options for accessing the target archive file in the
parent file system.controller
- the controller for the parent file system with the
target archive file.name
- the node name of the target archive file in the parent
file system.input
- the nullable InputService
for the target archive
file.
If not null
, then the target archive file is going to
get updated.
This parameter is guaranteed to be the product of this driver's
factory method
newInput(FsModel, BitField, FsController, FsNodeName)
.IOException
- on any I/O error.@CreatesObligation protected abstract net.java.truecommons.cio.OutputService<E> newOutput(FsModel model, FsOutputSocketSink sink, @CheckForNull @WillNotClose net.java.truecommons.cio.InputService<E> input) throws IOException
model
to the target archive file referenced by sink
.model
- the file system model.sink
- the sink for writing the target archive file.input
- the nullable InputService
for the target archive
file.
If not null
, then the target archive file is going to
get updated.
This parameter is guaranteed to be the product of this driver's
factory method
newInput(FsModel, BitField, FsController, FsNodeName)
.IOException
- on any I/O error.newOutput(FsModel, BitField, FsController, FsNodeName, InputService)
public static String normalize(String name, net.java.truecommons.cio.Entry.Type type)
'/'
if and only if type
is
DIRECTORY
.name
- an entry name.type
- an entry type.protected FsOutputSocketSink sink(net.java.truecommons.shed.BitField<FsAccessOption> options, FsController controller, FsNodeName name)
name
in controller
using options
and
the nullable template
.
This method is overridable to enable modifying 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.
options
- the options for accessing the file system node.controller
- the controller to use for writing an artifact of this
driver.name
- the node name.newOutput(FsModel, BitField, FsController, FsNodeName, InputService)
protected FsInputSocketSource source(net.java.truecommons.shed.BitField<FsAccessOption> options, FsController controller, FsNodeName name)
name
in controller
using options
.
This method is overridable to enable modifying 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.
options
- the options for accessing the file system node.controller
- the controller to use for reading an artifact of this
driver.name
- the node name.newInput(FsModel, BitField, FsController, FsNodeName)
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.