@NotThreadSafe public class TarOutputShop extends TarArchiveOutputStream implements OutputShop<TarDriverEntry>
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.
TarInputShop
BIGNUMBER_ERROR, BIGNUMBER_POSIX, BIGNUMBER_STAR, LONGFILE_ERROR, LONGFILE_GNU, LONGFILE_POSIX, LONGFILE_TRUNCATE
Constructor and Description |
---|
TarOutputShop(TarDriver driver,
OutputStream out) |
Modifier and Type | Method and Description |
---|---|
TarDriverEntry |
getEntry(String name)
Returns the entry for the given
name or
null if no entry with this name exists in this container. |
OutputSocket<TarDriverEntry> |
getOutputSocket(TarDriverEntry local)
Returns an output socket for writing to the given entry.
|
int |
getSize()
Returns the number of entries in this container.
|
Iterator<TarDriverEntry> |
iterator()
Returns a new iterator for all entries in this container.
|
close, closeArchiveEntry, createArchiveEntry, finish, flush, getBytesWritten, getCount, getRecordSize, putArchiveEntry, setAddPaxHeadersForNonAsciiNames, setBigNumberMode, setLongFileMode, write
canWriteEntryData, count, count, write
write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
forEach, spliterator
@CreatesObligation public TarOutputShop(TarDriver driver, @WillCloseWhenClosed OutputStream out)
@CheckForNull public TarDriverEntry getEntry(String name)
EntryContainer
name
or
null
if no entry with this name exists in this container.getEntry
in interface EntryContainer<TarDriverEntry>
name
- an entry name.name
or
null
if no entry with this name exists in this container.public OutputSocket<TarDriverEntry> getOutputSocket(TarDriverEntry local)
OutputService
getOutputSocket
in interface OutputService<TarDriverEntry>
local
- the entry, which will be the
local target
of the returned
output socket.public int getSize()
EntryContainer
getSize
in interface EntryContainer<TarDriverEntry>
public Iterator<TarDriverEntry> iterator()
OutputService
First, the iteration must be consistent: Multiple iterators must iterate the same entries in the same order again unless the set of entries has changed.
Next, the iteration should also reflect the natural order of the entries in this container. For example, if this container represents an archive file, the iteration should reflect the natural order of the entries in the archive file.
The iterator returned by this method must be unmodifiable.
iterator
in interface EntryContainer<TarDriverEntry>
iterator
in interface OutputService<TarDriverEntry>
iterator
in interface Iterable<TarDriverEntry>
Copyright © 2005–2018 Schlichtherle IT Services. All rights reserved.