|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.OutputStream
org.apache.commons.compress.archivers.ArchiveOutputStream
org.apache.commons.compress.archivers.tar.TarArchiveOutputStream
public class TarArchiveOutputStream
The TarOutputStream writes a UNIX tar archive as an OutputStream. Methods are provided to put entries, and then write their contents by writing to this stream using write().
| Field Summary | |
|---|---|
protected org.apache.commons.compress.archivers.tar.TarBuffer |
buffer
|
static int |
LONGFILE_ERROR
Fail if a long file name is required in the archive. |
static int |
LONGFILE_GNU
GNU tar extensions are used to store long file names in the archive. |
static int |
LONGFILE_TRUNCATE
Long paths will be truncated in the archive. |
| Constructor Summary | |
|---|---|
TarArchiveOutputStream(OutputStream os)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(OutputStream os,
int blockSize)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(OutputStream os,
int blockSize,
int recordSize)
Constructor for TarInputStream. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying OutputStream. |
void |
closeArchiveEntry()
Close an entry. |
ArchiveEntry |
createArchiveEntry(File inputFile,
String entryName)
Create an archive entry using the inputFile and entryName provided. |
void |
finish()
Ends the TAR archive without closing the underlying OutputStream. |
void |
flush()
|
int |
getRecordSize()
Get the record size being used by this stream's TarBuffer. |
void |
putArchiveEntry(ArchiveEntry archiveEntry)
Put an entry on the output stream. |
void |
setLongFileMode(int longFileMode)
Set the long file mode. |
void |
write(byte[] wBuf,
int wOffset,
int numToWrite)
Writes bytes to the current tar archive entry. |
| Methods inherited from class org.apache.commons.compress.archivers.ArchiveOutputStream |
|---|
canWriteEntryData, count, count, getBytesWritten, getCount, write |
| Methods inherited from class java.io.OutputStream |
|---|
write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LONGFILE_ERROR
public static final int LONGFILE_TRUNCATE
public static final int LONGFILE_GNU
protected final org.apache.commons.compress.archivers.tar.TarBuffer buffer
| Constructor Detail |
|---|
public TarArchiveOutputStream(OutputStream os)
os - the output stream to use
public TarArchiveOutputStream(OutputStream os,
int blockSize)
os - the output stream to useblockSize - the block size to use
public TarArchiveOutputStream(OutputStream os,
int blockSize,
int recordSize)
os - the output stream to useblockSize - the block size to userecordSize - the record size to use| Method Detail |
|---|
public void setLongFileMode(int longFileMode)
longFileMode - the mode to use
public void finish()
throws IOException
finish in class ArchiveOutputStreamIOException - on error
public void close()
throws IOException
close in interface Closeableclose in class OutputStreamIOException - on errorpublic int getRecordSize()
public void putArchiveEntry(ArchiveEntry archiveEntry)
throws IOException
putArchiveEntry in class ArchiveOutputStreamarchiveEntry - The TarEntry to be written to the archive.
IOException - on error
ClassCastException - if archiveEntry is not an instance of TarArchiveEntry
public void closeArchiveEntry()
throws IOException
closeArchiveEntry in class ArchiveOutputStreamIOException - on error
public void write(byte[] wBuf,
int wOffset,
int numToWrite)
throws IOException
write in class OutputStreamwBuf - The buffer to write to the archive.wOffset - The offset in the buffer from which to get bytes.numToWrite - The number of bytes to write.
IOException - on error
public void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOException
public ArchiveEntry createArchiveEntry(File inputFile,
String entryName)
throws IOException
createArchiveEntry in class ArchiveOutputStreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||