@NotThreadSafe public class TarOutputShop extends TarArchiveOutputStream implements OutputShop<TarDriverEntry>
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
OutputStream.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.BufferedEntryOutputStream
This entry output stream writes the entry to a temporary file.
|
private class |
TarOutputShop.EntryOutputStream
This entry output stream writes directly to our subclass.
|
| Modifier and Type | Field and Description |
|---|---|
private boolean |
busy |
private OutputStream |
delegate |
private Map<String,TarDriverEntry> |
entries
Maps entry names to tar entries [String -> TarDriverEntry].
|
static int |
OVERHEAD_SIZE
The number of entries which can be initially accomodated by
the internal hash map without resizing it, which is 47.
|
private IOPool<?> |
pool |
buffer, LONGFILE_ERROR, LONGFILE_GNU, LONGFILE_TRUNCATE| Constructor and Description |
|---|
TarOutputShop(TarDriver driver,
OutputStream out) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
TarDriverEntry |
getEntry(String name) |
OutputSocket<TarDriverEntry> |
getOutputSocket(TarDriverEntry entry) |
int |
getSize() |
private boolean |
isBusy()
Returns whether this output archive is busy writing an archive entry
or not.
|
Iterator<TarDriverEntry> |
iterator() |
closeArchiveEntry, createArchiveEntry, finish, flush, getBytesWritten, getCount, getRecordSize, putArchiveEntry, setLongFileMode, writecanWriteEntryData, count, count, writewriteprivate boolean busy
private final OutputStream delegate
private final Map<String,TarDriverEntry> entries
public static final int OVERHEAD_SIZE
private final IOPool<?> pool
@CreatesObligation public TarOutputShop(TarDriver driver, @WillCloseWhenClosed OutputStream out)
public void close()
throws IOException
close in interface OutputShop<TarDriverEntry>close in interface Closeableclose in interface AutoCloseableclose in class TarArchiveOutputStreamIOException@CheckForNull public TarDriverEntry getEntry(String name)
getEntry in interface EntryContainer<TarDriverEntry>public OutputSocket<TarDriverEntry> getOutputSocket(TarDriverEntry entry)
getOutputSocket in interface OutputService<TarDriverEntry>public int getSize()
getSize in interface EntryContainer<TarDriverEntry>private boolean isBusy()
public Iterator<TarDriverEntry> iterator()
iterator in interface EntryContainer<TarDriverEntry>iterator in interface OutputService<TarDriverEntry>iterator in interface Iterable<TarDriverEntry>Copyright © 2005-2012 Schlichtherle IT Services. All Rights Reserved.