|
||||||||||
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.commons.compress.archivers.tar.TarOutputStream
public final class TarOutputStream
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().
TarInputStream
,
TarEntry
Field Summary | |
---|---|
static int |
LONGFILE_ERROR
Flag to indicate that an error should be generated if an attempt is made to write an entry that exceeds the 100 char POSIX limit. |
static int |
LONGFILE_GNU
Flag to indicate that entry name should be formatted according to GNU tar extension if an attempt is made to write an entry that exceeds the 100 char POSIX limit. |
static int |
LONGFILE_TRUNCATE
Flag to indicate that entry name should be truncated if an attempt is made to write an entry that exceeds the 100 char POSIX limit. |
Fields inherited from class java.io.FilterOutputStream |
---|
out |
Constructor Summary | |
---|---|
TarOutputStream(OutputStream output)
Construct a TarOutputStream using specified input stream and default block and record sizes. |
|
TarOutputStream(OutputStream output,
int blockSize)
Construct a TarOutputStream using specified input stream, block size and default record sizes. |
|
TarOutputStream(OutputStream output,
int blockSize,
int recordSize)
Construct a TarOutputStream using specified input stream, block size and record sizes. |
Method Summary | |
---|---|
void |
close()
Ends the TAR archive and closes the underlying OutputStream. |
void |
closeEntry()
Close an entry. |
void |
finish()
Ends the TAR archive without closing the underlying OutputStream. |
int |
getRecordSize()
Get the record size being used by this stream's TarBuffer. |
void |
putNextEntry(TarEntry entry)
Put an entry on the output stream. |
void |
setBufferDebug(boolean debug)
Sets the debugging flag in this stream's TarBuffer. |
void |
setLongFileMode(int longFileMode)
Set the mode used to work with entrys exceeding 100 chars (and thus break the POSIX standard). |
void |
write(byte[] buffer)
Writes bytes to the current tar archive entry. |
void |
write(byte[] buffer,
int offset,
int count)
Writes bytes to the current tar archive entry. |
void |
write(int data)
Writes a byte to the current tar archive entry. |
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 |
Field Detail |
---|
public static final int LONGFILE_ERROR
public static final int LONGFILE_TRUNCATE
public static final int LONGFILE_GNU
Constructor Detail |
---|
public TarOutputStream(OutputStream output)
output
- stream to create TarOutputStream fromTarBuffer.DEFAULT_BLOCKSIZE
,
TarBuffer.DEFAULT_RECORDSIZE
public TarOutputStream(OutputStream output, int blockSize)
output
- stream to create TarOutputStream fromblockSize
- the block sizeTarBuffer.DEFAULT_RECORDSIZE
public TarOutputStream(OutputStream output, int blockSize, int recordSize)
output
- stream to create TarOutputStream fromblockSize
- the block sizerecordSize
- the record sizeMethod Detail |
---|
public void setBufferDebug(boolean debug)
debug
- The new BufferDebug valuepublic void setLongFileMode(int longFileMode)
longFileMode
- the modepublic int getRecordSize()
public void close() throws IOException
close
in interface Closeable
close
in class FilterOutputStream
IOException
- when an IO error causes operation to failpublic void closeEntry() throws IOException
IOException
- when an IO error causes operation to failpublic void finish() throws IOException
IOException
- when an IO error causes operation to failpublic void putNextEntry(TarEntry entry) throws IOException
entry
- The TarEntry to be written to the archive.
IOException
- when an IO error causes operation to failpublic void write(int data) throws IOException
write
in class FilterOutputStream
data
- The byte written.
IOException
- when an IO error causes operation to failpublic void write(byte[] buffer) throws IOException
write
in class FilterOutputStream
buffer
- The buffer to write to the archive.
IOException
- when an IO error causes operation to failpublic void write(byte[] buffer, int offset, int count) throws IOException
write
in class FilterOutputStream
buffer
- The buffer to write to the archive.offset
- The offset in the buffer from which to get bytes.count
- The number of bytes to write.
IOException
- when an IO error causes operation to fail
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |