@DefaultAnnotation(value=edu.umd.cs.findbugs.annotations.NonNull.class) public class TarOutputShop extends TarArchiveOutputStream implements OutputShop<TTarArchiveEntry>
OutputShop to write TAR archives.
Because the TAR file format needs to know each entry's length in advance,
entries from an unknown source are actually written to temp files and copied
to the underlying TarArchiveOutputStream upon a call to their
TarOutputShop.EntryOutputStream.close() method.
Note that this implies that the close() method may fail with
an IOException.
If the size of an entry is known in advance it's directly written to the
underlying TarArchiveOutputStream instead.
This output archive can only write one entry concurrently.
Archive drivers may wrap this class in a FsMultiplexedOutputShop
to overcome this limitation.
TarInputShop| Modifier and Type | Class and Description |
|---|---|
private class |
TarOutputShop.EntryOutputStream
This entry output stream writes directly to our subclass.
|
private class |
TarOutputShop.TempEntryOutputStream
This entry output stream writes the entry to a temporary file.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
busy |
private Map<String,TTarArchiveEntry> |
entries
Maps entry names to tar entries [String -> TTarArchiveEntry].
|
static int |
OVERHEAD_SIZE
The number of entries which can be initially accomodated by
the internal hash map without resizing it, which is 64.
|
private IOPool<?> |
pool |
buffer, LONGFILE_ERROR, LONGFILE_GNU, LONGFILE_TRUNCATE| Constructor and Description |
|---|
TarOutputShop(TarDriver driver,
OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
TTarArchiveEntry |
getEntry(String name) |
OutputSocket<TTarArchiveEntry> |
getOutputSocket(TTarArchiveEntry entry) |
int |
getSize() |
private boolean |
isBusy()
Returns whether this output archive is busy writing an archive entry
or not.
|
Iterator<TTarArchiveEntry> |
iterator() |
close, closeArchiveEntry, createArchiveEntry, finish, flush, getRecordSize, putArchiveEntry, setLongFileMode, writecanWriteEntryData, count, count, getBytesWritten, getCount, writewriteprivate boolean busy
private final Map<String,TTarArchiveEntry> entries
public static final int OVERHEAD_SIZE
private final IOPool<?> pool
public TarOutputShop(TarDriver driver, OutputStream out)
public TTarArchiveEntry getEntry(String name)
getEntry in interface EntryContainer<TTarArchiveEntry>public OutputSocket<TTarArchiveEntry> getOutputSocket(TTarArchiveEntry entry)
getOutputSocket in interface OutputService<TTarArchiveEntry>public int getSize()
getSize in interface EntryContainer<TTarArchiveEntry>private boolean isBusy()
public Iterator<TTarArchiveEntry> iterator()
iterator in interface EntryContainer<TTarArchiveEntry>iterator in interface Iterable<TTarArchiveEntry>Copyright © 2004-2011 Schlichtherle IT Services. All Rights Reserved.