|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
java.io.FilterOutputStream
org.apache.tools.tar.TarOutputStream
de.schlichtherle.io.archive.tar.TarOutputArchive
public class TarOutputArchive
An implementation of OutputArchive to write TAR archives.
Because the TAR file format needs to know each entry's length in advance,
entries from an unknown source (such as entries created with
FileOutputStream) are actually written to temp files and copied
to the underlying TarOutputStream upon a call to their
OutputStream.close() method.
Note that this implies that the close() method may fail with
an IOException.
Entries which's size is known in advance (such as entries copied with one
of the (archiveC|c)opy(All)?(From|To) methods in the
File class) are directly written to the underlying
TarOutputStream instead.
This output archive can only write one entry at a time.
Archive drivers may wrap this class in a MultiplexedOutputArchive
to overcome this limitation.
| Field Summary |
|---|
| Fields inherited from class org.apache.tools.tar.TarOutputStream |
|---|
assemBuf, assemLen, buffer, currBytes, currName, currSize, debug, LONGFILE_ERROR, LONGFILE_GNU, LONGFILE_TRUNCATE, longFileMode, oneBuf, recordBuf |
| Fields inherited from class java.io.FilterOutputStream |
|---|
out |
| Constructor Summary | |
|---|---|
TarOutputArchive(OutputStream out)
|
|
| Method Summary | |
|---|---|
Enumeration |
getArchiveEntries()
Returns an enumeration of the ArchiveEntry instances in this
archive (i.e. written so far). |
ArchiveEntry |
getArchiveEntry(String entryName)
Returns the ArchiveEntry for the given entry name or
null if no entry with this name has been written
or started to be written. |
OutputArchiveMetaData |
getMetaData()
Returns the meta data for this input archive. |
int |
getNumArchiveEntries()
Returns the number of ArchiveEntry instances in this archive. |
OutputStream |
getOutputStream(ArchiveEntry entry,
ArchiveEntry srcEntry)
Returns a new OutputStream for writing the contents of the
given archive entry. |
void |
setMetaData(OutputArchiveMetaData metaData)
Sets the meta data for this input archive. |
void |
storeDirectory(ArchiveEntry entry)
Deprecated. This method will be removed in the next major version number release and should be implemented as getOutputStream(entry, null).close(). |
| Methods inherited from class org.apache.tools.tar.TarOutputStream |
|---|
close, closeEntry, finish, getRecordSize, putNextEntry, setBufferDebug, setDebug, setLongFileMode, write, write, write |
| Methods inherited from class java.io.FilterOutputStream |
|---|
flush |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface de.schlichtherle.io.archive.spi.OutputArchive |
|---|
close |
| Constructor Detail |
|---|
public TarOutputArchive(OutputStream out)
| Method Detail |
|---|
public int getNumArchiveEntries()
OutputArchiveArchiveEntry instances in this archive.
This method may be called before the archive is closed and must also reflect entries which have not yet been closed.
getNumArchiveEntries in interface OutputArchivepublic Enumeration getArchiveEntries()
OutputArchiveArchiveEntry instances in this
archive (i.e. written so far).
This method may be called before the archive is closed and must also reflect entries which have not yet been closed.
getArchiveEntries in interface OutputArchivepublic ArchiveEntry getArchiveEntry(String entryName)
OutputArchiveArchiveEntry for the given entry name or
null if no entry with this name has been written
or started to be written.
This method may be called before the archive is closed and must also reflect entries which have not yet been closed.
getArchiveEntry in interface OutputArchiveentryName - A valid archive entry name - never null.
public OutputStream getOutputStream(ArchiveEntry entry,
ArchiveEntry srcEntry)
throws IOException
OutputArchiveOutputStream for writing the contents of the
given archive entry.
The returned stream should preferrably be unbuffered, as buffering is usually done in higher layers (all copy routines in TrueZIP do this and most client applications do it, too). Buffering twice does not increase, but decrease performance.
Note that the stream is guaranteed to be closed before the
OutputArchive.close() method of this archive is called!
getOutputStream in interface OutputArchiveentry - A valid reference to an archive entry.
The runtime class of this entry is the same as the runtime class
of the entries returned by
ArchiveDriver.createArchiveEntry(de.schlichtherle.io.archive.Archive, java.lang.String, de.schlichtherle.io.archive.spi.ArchiveEntry).srcEntry - If not null, this identifies the entry
from which TrueZIP is actually copying data from and should be
used to implement the Direct Data Copying (DDC) feature.
Note that there is no guarantee on the runtime type of this
object; it may have been created by other drivers.
Furthermore, this not exclusively used for archive
copies, so you should not simply copy all properties
of the source entry to the entry (see
ArchiveDriver.createArchiveEntry(Archive, String, ArchiveEntry)
for comparison).
For example, the ZIP driver family uses this to copy the
already deflated data if the source entry is another
ZIP file entry.
As another example, the TarDriver
uses this to determine the size of the input file, thereby
removing the need to create (yet another) temporary file.
OutputStream to write the
archive entry data to.
null is not allowed!
OutputArchiveBusyException - If the archive is currently busy
on output for another entry.
This exception is guaranteed to be recoverable, meaning it
should be possible to write the same entry again as soon as
the archive is not busy on output anymore.
FileNotFoundException - If the archive entry is not accessible
for some reason.
IOException - On any other exceptional condition.
public final void storeDirectory(ArchiveEntry entry)
throws IOException
getOutputStream(entry, null).close().
OutputArchiveentry as a directory enry.
storeDirectory in interface OutputArchiveentry - The archive entry to write. This is never
null and safe to be casted to the archive entry
type actually created by the
ArchiveDriver.createArchiveEntry(de.schlichtherle.io.archive.Archive, java.lang.String, de.schlichtherle.io.archive.spi.ArchiveEntry) method.
IOException - On any exceptional condition.public OutputArchiveMetaData getMetaData()
OutputArchivenull.
getMetaData in interface OutputArchivepublic void setMetaData(OutputArchiveMetaData metaData)
OutputArchive
setMetaData in interface OutputArchivemetaData - The meta data - may not be null.
|
TrueZIP 6.8 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||