|
||||||||||
| 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 | |
|---|---|
static int |
BIGNUMBER_ERROR
Fail if a big number (e.g. size > 8GiB) is required in the archive. |
static int |
BIGNUMBER_POSIX
POSIX/PAX extensions are used to store big numbers in the archive. |
static int |
BIGNUMBER_STAR
star/GNU tar/BSD tar extensions are used to store big number in the archive. |
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_POSIX
POSIX/PAX 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. |
|
TarArchiveOutputStream(OutputStream os,
int blockSize,
int recordSize,
String encoding)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(OutputStream os,
int blockSize,
String encoding)
Constructor for TarInputStream. |
|
TarArchiveOutputStream(OutputStream os,
String encoding)
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()
|
long |
getBytesWritten()
Returns the current number of bytes written to this stream. |
int |
getCount()
Deprecated. |
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 |
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 |
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, 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
public static final int LONGFILE_POSIX
public static final int BIGNUMBER_ERROR
public static final int BIGNUMBER_STAR
public static final int BIGNUMBER_POSIX
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,
String encoding)
os - the output stream to useencoding - name of the encoding to use for file names
public TarArchiveOutputStream(OutputStream os,
int blockSize)
os - the output stream to useblockSize - the block size to use
public TarArchiveOutputStream(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 names
public TarArchiveOutputStream(OutputStream os,
int blockSize,
int recordSize)
os - the output stream to useblockSize - the block size to userecordSize - the record size to use
public TarArchiveOutputStream(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 names| Method Detail |
|---|
public void setLongFileMode(int longFileMode)
longFileMode - the mode to usepublic void setBigNumberMode(int bigNumberMode)
bigNumberMode - the mode to usepublic void setAddPaxHeadersForNonAsciiNames(boolean b)
@Deprecated public int getCount()
ArchiveOutputStream
getCount in class ArchiveOutputStreampublic long getBytesWritten()
ArchiveOutputStream
getBytesWritten in class ArchiveOutputStream
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 | |||||||||