|
|||||||||
| 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(java.io.OutputStream os)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(java.io.OutputStream os,
int blockSize)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(java.io.OutputStream os,
int blockSize,
int recordSize)
Constructor for TarInputStream. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the underlying OutputStream. |
void |
closeArchiveEntry()
Close an entry. |
ArchiveEntry |
createArchiveEntry(java.io.File inputFile,
java.lang.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 |
|---|
count, 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(java.io.OutputStream os)
os - the output stream to use
public TarArchiveOutputStream(java.io.OutputStream os,
int blockSize)
os - the output stream to useblockSize - the block size to use
public TarArchiveOutputStream(java.io.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 java.io.IOException
finish in class ArchiveOutputStreamjava.io.IOException - on error
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in class java.io.OutputStreamjava.io.IOException - on errorpublic int getRecordSize()
public void putArchiveEntry(ArchiveEntry archiveEntry)
throws java.io.IOException
putArchiveEntry in class ArchiveOutputStreamarchiveEntry - The TarEntry to be written to the archive.
java.io.IOException - on error
java.lang.ClassCastException - if archiveEntry is not an instance of TarArchiveEntry
public void closeArchiveEntry()
throws java.io.IOException
closeArchiveEntry in class ArchiveOutputStreamjava.io.IOException - on error
public void write(byte[] wBuf,
int wOffset,
int numToWrite)
throws java.io.IOException
write in class java.io.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.
java.io.IOException - on error
public void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException
public ArchiveEntry createArchiveEntry(java.io.File inputFile,
java.lang.String entryName)
throws java.io.IOException
ArchiveOutputStream
createArchiveEntry in class ArchiveOutputStreamjava.io.IOException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||