@Immutable public class TarDriver extends FsCharsetArchiveDriver<TarDriverEntry>
Subclasses must be thread-safe and should be immutable!
| Modifier and Type | Field and Description |
|---|---|
static Charset |
TAR_CHARSET
The character set for entry names and comments, which is the default
character set.
|
| Constructor and Description |
|---|
TarDriver(IOPoolProvider provider)
Constructs a new TAR driver.
|
| Modifier and Type | Method and Description |
|---|---|
InputSocket<?> |
getInputSocket(FsController<?> controller,
FsEntryName name,
BitField<FsInputOption> options)
|
OutputSocket<?> |
getOutputSocket(FsController<?> controller,
FsEntryName name,
BitField<FsOutputOption> options,
Entry template)
|
protected IOPool<?> |
getPool()
Returns the I/O buffer pool to use 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. |
TarDriverEntry |
newEntry(String name) |
TarDriverEntry |
newEntry(String name,
Entry.Type type,
Entry template,
BitField<FsOutputOption> mknod)
Returns a new entry for the given name.
|
TarDriverEntry |
newEntry(String name,
org.apache.commons.compress.archivers.tar.TarArchiveEntry template) |
TarInputShop |
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. |
OutputShop<TarDriverEntry> |
newOutputShop(FsModel model,
OutputSocket<?> output,
InputShop<TarDriverEntry> source)
Creates a new output shop for writing archive entries for the
given
model to the given output socket's target. |
protected TarInputShop |
newTarInputShop(FsModel model,
InputStream in) |
protected TarOutputShop |
newTarOutputShop(FsModel model,
OutputStream out,
TarInputShop source) |
assertEncodable, getCharset, toString, toZipOrTarEntryNamegetRedundantMetaDataSupport, isFederated, newController, newController, newEntrygetPrioritypublic static final Charset TAR_CHARSET
public TarDriver(IOPoolProvider provider)
provider - the provider for the I/O buffer pool.public InputSocket<?> getInputSocket(FsController<?> controller, FsEntryName name, BitField<FsInputOption> options)
getInputSocket in class FsArchiveDriver<TarDriverEntry>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)
getOutputSocket in class FsArchiveDriver<TarDriverEntry>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.protected final IOPool<?> getPool()
FsArchiveDriverMultiple invocations should return the same I/O buffer pool. However, callers should cache the return value for subsequent use in case it isn't always the same.
getPool in class FsArchiveDriver<TarDriverEntry>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.getRedundantContentSupport in class FsArchiveDriver<TarDriverEntry>TarDriver returns
true because when reading a TAR file sequentially,
each TAR entry should "override" any previously read
TAR entry with an equal name.public TarDriverEntry newEntry(String name)
public TarDriverEntry newEntry(String name, Entry.Type type, Entry template, BitField<FsOutputOption> mknod) throws CharConversionException
FsArchiveDriverentry 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 state with the template.
newEntry in class FsArchiveDriver<TarDriverEntry>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 FsController.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 - TODO: This has been deprecated and
should get removed.public TarDriverEntry newEntry(String name, org.apache.commons.compress.archivers.tar.TarArchiveEntry template)
public TarInputShop newInputShop(FsModel model, InputSocket<?> input) throws IOException
model from the given input socket's target.
Note that the returned input shop does not need to be thread-safe.
The implementation in the class TarDriver acquires an input
stream from the given socket and forwards the call to
newTarInputShop(de.schlichtherle.truezip.fs.FsModel, java.io.InputStream).
newInputShop in class FsArchiveDriver<TarDriverEntry>model - the file system model.input - the input socket for reading the contents of the
archive file from its target.
This is guaranteed to be the product of this driver's
FsArchiveDriver.getInputSocket(de.schlichtherle.truezip.fs.FsController<?>, de.schlichtherle.truezip.fs.FsEntryName, de.schlichtherle.truezip.util.BitField<de.schlichtherle.truezip.fs.FsInputOption>) method.IOException - on any I/O error.
If the file system entry 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 is
synced
again.
Otherwise, this exception is deemed to indicate a
transient false positive archive file and does not
get cached.public OutputShop<TarDriverEntry> newOutputShop(FsModel model, OutputSocket<?> output, InputShop<TarDriverEntry> source) throws IOException
model to the given output socket's target.
Note that the returned output shop does not need to be thread-safe.
The implementation in the class TarDriver acquires an output
stream from the given socket, forwards the call to
newTarOutputShop(de.schlichtherle.truezip.fs.FsModel, java.io.OutputStream, de.schlichtherle.truezip.fs.archive.tar.TarInputShop) and wraps the result in a new
MultiplexedOutputShop.
newOutputShop in class FsArchiveDriver<TarDriverEntry>model - the file system model.output - the output socket for writing the contents of the
archive file to its target.
This is guaranteed to be the product of this driver's
FsArchiveDriver.getOutputSocket(de.schlichtherle.truezip.fs.FsController<?>, de.schlichtherle.truezip.fs.FsEntryName, de.schlichtherle.truezip.util.BitField<de.schlichtherle.truezip.fs.FsOutputOption>, de.schlichtherle.truezip.entry.Entry) method.source - the InputShop if archive is going to get
updated.
If not null, this is guaranteed to be the product
of this driver's FsArchiveDriver.newInputShop(de.schlichtherle.truezip.fs.FsModel, de.schlichtherle.truezip.socket.InputSocket<?>) factory method.
This feature could get used to copy some meta data which is
specific to the type of archive this driver supports,
e.g. the comment of a ZIP file.IOException - on any I/O error.@CreatesObligation protected TarInputShop newTarInputShop(FsModel model, @WillCloseWhenClosed InputStream in) throws IOException
IOException@CreatesObligation protected TarOutputShop newTarOutputShop(FsModel model, OutputStream out, @CheckForNull@WillNotClose TarInputShop source) throws IOException
IOExceptionCopyright © 2005-2013 Schlichtherle IT Services. All Rights Reserved.