public class TarArchiveInputStream extends ArchiveInputStream
| Constructor and Description |
|---|
TarArchiveInputStream(InputStream is)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
boolean lenient)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
int blockSize)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
int blockSize,
int recordSize)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
int blockSize,
int recordSize,
String encoding)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
int blockSize,
int recordSize,
String encoding,
boolean lenient)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
int blockSize,
String encoding)
Constructor for TarInputStream.
|
TarArchiveInputStream(InputStream is,
String encoding)
Constructor for TarInputStream.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Get the available data that can be read from the current
entry in the archive.
|
boolean |
canReadEntryData(ArchiveEntry ae)
Whether this class is able to read the given entry.
|
void |
close()
Closes this stream.
|
TarArchiveEntry |
getCurrentEntry()
Get the current TAR Archive Entry that this input stream is processing
|
protected byte[] |
getLongNameData()
Get the next entry in this tar archive as longname data.
|
ArchiveEntry |
getNextEntry()
Returns the next Archive Entry in this Stream.
|
TarArchiveEntry |
getNextTarEntry()
Get the next entry in this tar archive.
|
int |
getRecordSize()
Get the record size being used by this stream's buffer.
|
protected boolean |
isAtEOF() |
protected boolean |
isEOFRecord(byte[] record)
Determine if an archive record indicate End of Archive.
|
void |
mark(int markLimit)
Since we do not support marking just yet, we do nothing.
|
boolean |
markSupported()
Since we do not support marking just yet, we return false.
|
static boolean |
matches(byte[] signature,
int length)
Checks if the signature matches what is expected for a tar file.
|
int |
read(byte[] buf,
int offset,
int numToRead)
Reads bytes from the current tar archive entry.
|
protected byte[] |
readRecord()
Read a record from the input stream and return the data.
|
void |
reset()
Since we do not support marking just yet, we do nothing.
|
protected void |
setAtEOF(boolean b) |
protected void |
setCurrentEntry(TarArchiveEntry e) |
long |
skip(long n)
Skips over and discards
n bytes of data from this input
stream. |
count, count, getBytesRead, getCount, pushedBackBytes, readreadpublic TarArchiveInputStream(InputStream is)
is - the input stream to usepublic TarArchiveInputStream(InputStream is, boolean lenient)
is - the input stream to uselenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.public TarArchiveInputStream(InputStream is, String encoding)
is - the input stream to useencoding - name of the encoding to use for file namespublic TarArchiveInputStream(InputStream is, int blockSize)
is - the input stream to useblockSize - the block size to usepublic TarArchiveInputStream(InputStream is, int blockSize, String encoding)
is - the input stream to useblockSize - the block size to useencoding - name of the encoding to use for file namespublic TarArchiveInputStream(InputStream is, int blockSize, int recordSize)
is - the input stream to useblockSize - the block size to userecordSize - the record size to usepublic TarArchiveInputStream(InputStream is, int blockSize, int recordSize, String encoding)
is - the input stream to useblockSize - the block size to userecordSize - the record size to useencoding - name of the encoding to use for file namespublic TarArchiveInputStream(InputStream is, int blockSize, int recordSize, String encoding, boolean lenient)
is - the input stream to useblockSize - the block size to userecordSize - the record size to useencoding - name of the encoding to use for file nameslenient - when set to true illegal values for group/userid, mode, device numbers and timestamp will be
ignored and the fields set to TarArchiveEntry.UNKNOWN. When set to false such illegal fields cause an
exception instead.public void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOException - on errorpublic int getRecordSize()
public int available() throws IOException
available in class InputStreamIOException - for signaturepublic long skip(long n) throws IOException
n bytes of data from this input
stream. The skip method may, for a variety of reasons, end
up skipping over some smaller number of bytes, possibly 0.
This may result from any of a number of conditions; reaching end of file
or end of entry before n bytes have been skipped; are only
two possibilities. The actual number of bytes skipped is returned. If
n is negative, no bytes are skipped.skip in class InputStreamn - the number of bytes to be skipped.IOException - if a truncated tar archive is detected
or some other I/O error occurspublic boolean markSupported()
markSupported in class InputStreampublic void mark(int markLimit)
mark in class InputStreammarkLimit - The limit to mark.public void reset()
reset in class InputStreampublic TarArchiveEntry getNextTarEntry() throws IOException
IOException - on errorprotected byte[] getLongNameData() throws IOException
IOException - on errorprotected boolean isEOFRecord(byte[] record)
record - The record data to check.protected byte[] readRecord() throws IOException
IOException - on errorpublic ArchiveEntry getNextEntry() throws IOException
getNextEntry in class ArchiveInputStreamnull if there are no more entriesIOException - if the next entry could not be readpublic int read(byte[] buf, int offset, int numToRead) throws IOException
read in class InputStreambuf - The buffer into which to place bytes read.offset - The offset at which to place bytes read.numToRead - The number of bytes to read.IOException - on errorpublic boolean canReadEntryData(ArchiveEntry ae)
canReadEntryData in class ArchiveInputStreamae - the entry to testArchiveEntry is an instance of TarArchiveEntrypublic TarArchiveEntry getCurrentEntry()
protected final void setCurrentEntry(TarArchiveEntry e)
protected final boolean isAtEOF()
protected final void setAtEOF(boolean b)
public static boolean matches(byte[] signature, int length)
signature - the bytes to checklength - the number of bytes to checkCopyright © 2002–2020 The Apache Software Foundation. All rights reserved.