public class TarOutputStream extends FilterOutputStream
| Modifier and Type | Field and Description | 
|---|---|
| protected byte[] | assemBuf | 
| protected int | assemLen | 
| static int | BIGNUMBER_ERRORFail if a big number (e.g. | 
| static int | BIGNUMBER_POSIXPOSIX/PAX extensions are used to store big numbers in the archive. | 
| static int | BIGNUMBER_STARstar/GNU tar/BSD tar extensions are used to store big number in the archive. | 
| protected TarBuffer | buffer | 
| protected long | currBytes | 
| protected String | currName | 
| protected long | currSize | 
| protected boolean | debug | 
| static int | LONGFILE_ERRORFail if a long file name is required in the archive. | 
| static int | LONGFILE_GNUGNU tar extensions are used to store long file names in the archive. | 
| static int | LONGFILE_POSIXPOSIX/PAX extensions are used to store long file names in the archive. | 
| static int | LONGFILE_TRUNCATELong paths will be truncated in the archive. | 
| protected int | longFileMode | 
| protected byte[] | oneBuf | 
| protected byte[] | recordBuf | 
out| Constructor and Description | 
|---|
| TarOutputStream(OutputStream os)Constructor for TarInputStream. | 
| TarOutputStream(OutputStream os,
               int blockSize)Constructor for TarInputStream. | 
| TarOutputStream(OutputStream os,
               int blockSize,
               int recordSize)Constructor for TarInputStream. | 
| TarOutputStream(OutputStream os,
               int blockSize,
               int recordSize,
               String encoding)Constructor for TarInputStream. | 
| TarOutputStream(OutputStream os,
               int blockSize,
               String encoding)Constructor for TarInputStream. | 
| TarOutputStream(OutputStream os,
               String encoding)Constructor for TarInputStream. | 
| Modifier and Type | Method and Description | 
|---|---|
| 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 | setAddPaxHeadersForNonAsciiNames(boolean b)Whether to add a PAX extension header for non-ASCII file names. | 
| void | setBigNumberMode(int bigNumberMode)Set the big number mode. | 
| void | setBufferDebug(boolean debug)Sets the debugging flag in this stream's TarBuffer. | 
| void | setDebug(boolean debugF)Sets the debugging flag. | 
| void | setLongFileMode(int longFileMode)Set the long file mode. | 
| void | write(byte[] wBuf)Writes bytes to the current tar archive entry. | 
| void | write(byte[] wBuf,
     int wOffset,
     int numToWrite)Writes bytes to the current tar archive entry. | 
| void | write(int b)Writes a byte to the current tar archive entry. | 
flushprotected byte[] assemBuf
protected int assemLen
public static final int BIGNUMBER_ERROR
public static final int BIGNUMBER_POSIX
public static final int BIGNUMBER_STAR
protected TarBuffer buffer
protected long currBytes
protected String currName
protected long currSize
protected boolean debug
public static final int LONGFILE_ERROR
public static final int LONGFILE_GNU
public static final int LONGFILE_POSIX
public static final int LONGFILE_TRUNCATE
protected int longFileMode
protected byte[] oneBuf
protected byte[] recordBuf
public TarOutputStream(OutputStream os)
os - the output stream to usepublic TarOutputStream(OutputStream os, int blockSize)
os - the output stream to useblockSize - the block size to usepublic TarOutputStream(OutputStream os, int blockSize, int recordSize)
os - the output stream to useblockSize - the block size to userecordSize - the record size to usepublic TarOutputStream(OutputStream os, int blockSize, int recordSize, String encoding)
os - the output stream to useblockSize - the block size to userecordSize - the record size to useencoding - name of the encoding to use for file namespublic TarOutputStream(OutputStream os, int blockSize, String encoding)
os - the output stream to useblockSize - the block size to useencoding - name of the encoding to use for file namespublic TarOutputStream(OutputStream os, String encoding)
os - the output stream to useencoding - name of the encoding to use for file namespublic void close()
           throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterOutputStreamIOException - on errorFilterOutputStream.flush(), 
FilterOutputStream.outpublic void closeEntry()
                throws IOException
IOException - on errorpublic void finish()
            throws IOException
IOException - on errorpublic int getRecordSize()
public void putNextEntry(TarEntry entry) throws IOException
entry - The TarEntry to be written to the archive.IOException - on errorpublic void setAddPaxHeadersForNonAsciiNames(boolean b)
public void setBigNumberMode(int bigNumberMode)
bigNumberMode - the mode to usepublic void setBufferDebug(boolean debug)
debug - True to turn on debugging.public void setDebug(boolean debugF)
debugF - True to turn on debugging.public void setLongFileMode(int longFileMode)
longFileMode - the mode to usepublic void write(byte[] wBuf)
           throws IOException
write in class FilterOutputStreamwBuf - The buffer to write to the archive.IOException - on errorFilterOutputStream.write(byte[], int, int)public void write(byte[] wBuf,
                  int wOffset,
                  int numToWrite)
           throws IOException
write in class FilterOutputStreamwBuf - 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 errorFilterOutputStream.write(int)public void write(int b)
           throws IOException
write in class FilterOutputStreamb - The byte written.IOException - on error