public class TarArchiveOutputStream extends ArchiveOutputStream
| Modifier and Type | Field and Description |
|---|---|
static int |
BIGNUMBER_ERROR
Fail if a big number (e.g.
|
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.
|
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 and Description |
|---|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
TarArchiveOutputStream(OutputStream
Constructor for TarInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying OutputStream.
|
void |
closeArchiveEntry()
Close an entry.
|
ArchiveEntry |
createArchiveEntry(File
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
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.
|
canWriteEntryData, count, count, writewritepublic 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
public TarArchiveOutputStream(OutputStreamos)
os - the output stream to use
public TarArchiveOutputStream(OutputStreamos, String encoding)
os - the output stream to use
encoding - name of the encoding to use for file names
public TarArchiveOutputStream(OutputStreamos, int blockSize)
os - the output stream to use
blockSize - the block size to use
public TarArchiveOutputStream(OutputStreamos, int blockSize, String encoding)
os - the output stream to use
blockSize - the block size to use
encoding - name of the encoding to use for file names
public TarArchiveOutputStream(OutputStreamos, int blockSize, int recordSize)
os - the output stream to use
blockSize - the block size to use
recordSize - the record size to use
public TarArchiveOutputStream(OutputStreamos, int blockSize, int recordSize, String encoding)
os - the output stream to use
blockSize - the block size to use
recordSize - the record size to use
encoding - name of the encoding to use for file names
public void setLongFileMode(int longFileMode)
longFileMode - the mode to use
public void setBigNumberMode(int bigNumberMode)
bigNumberMode - the mode to use
public void setAddPaxHeadersForNonAsciiNames(boolean b)
@Deprecated public int getCount()
ArchiveOutputStream
getCount in class
ArchiveOutputStream
public long getBytesWritten()
ArchiveOutputStream
getBytesWritten in class
ArchiveOutputStream
public void finish()
throws IOException
finish in class
ArchiveOutputStream
IOException - on error
public void close()
throws IOException
close in interface
Closeable
close in interface
AutoCloseable
close in class
OutputStream
IOException - on error
public int getRecordSize()
public void putArchiveEntry(ArchiveEntryarchiveEntry) throws IOException
putArchiveEntry in class
ArchiveOutputStream
archiveEntry - 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
ArchiveOutputStream
IOException - on error
public void write(byte[] wBuf,
int wOffset,
int numToWrite)
throws IOException
write in class
OutputStream
wBuf - 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
Flushable
flush in class
OutputStream
IOException
public ArchiveEntrycreateArchiveEntry(File inputFile, String entryName) throws IOException
ArchiveOutputStream
createArchiveEntry in class
ArchiveOutputStream
IOException -