public class TarArchiveInputStream extends ArchiveInputStream<TarArchiveEntry>
| Constructor and Description |
|---|
TarArchiveInputStream(java.io.InputStream inputStream)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
boolean lenient)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
int recordSize)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
int recordSize,
java.lang.String encoding)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
int recordSize,
java.lang.String encoding,
boolean lenient)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
java.lang.String encoding)
Constructs a new instance.
|
TarArchiveInputStream(java.io.InputStream inputStream,
java.lang.String encoding)
Constructs a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Gets the available data that can be read from the current entry in the archive.
|
boolean |
canReadEntryData(ArchiveEntry archiveEntry)
Whether this class is able to read the given entry.
|
void |
close()
Closes this stream.
|
TarArchiveEntry |
getCurrentEntry()
Gets the current TAR Archive Entry that this input stream is processing
|
TarArchiveEntry |
getNextEntry()
Gets the next TarArchiveEntry in this stream.
|
TarArchiveEntry |
getNextTarEntry()
Deprecated.
Use
getNextEntry(). |
int |
getRecordSize()
Gets the record size being used by this stream's buffer.
|
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.
|
void |
reset()
Since we do not support marking just yet, we do nothing.
|
long |
skip(long n)
Skips over and discards
n bytes of data from this input stream. |
getBytesRead, getCharset, getCount, readpublic TarArchiveInputStream(java.io.InputStream inputStream)
inputStream - the input stream to usepublic TarArchiveInputStream(java.io.InputStream inputStream,
boolean lenient)
inputStream - 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(java.io.InputStream inputStream,
int blockSize)
inputStream - the input stream to useblockSize - the block size to usepublic TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
int recordSize)
inputStream - the input stream to useblockSize - the block size to userecordSize - the record size to usepublic TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
int recordSize,
java.lang.String encoding)
inputStream - 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(java.io.InputStream inputStream,
int blockSize,
int recordSize,
java.lang.String encoding,
boolean lenient)
inputStream - 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 TarArchiveInputStream(java.io.InputStream inputStream,
int blockSize,
java.lang.String encoding)
inputStream - the input stream to useblockSize - the block size to useencoding - name of the encoding to use for file namespublic TarArchiveInputStream(java.io.InputStream inputStream,
java.lang.String encoding)
inputStream - the input stream to useencoding - name of the encoding to use for file namespublic static boolean matches(byte[] signature,
int length)
signature - the bytes to checklength - the number of bytes to checkpublic int available()
throws java.io.IOException
available in class java.io.FilterInputStreamjava.io.IOException - for signaturepublic boolean canReadEntryData(ArchiveEntry archiveEntry)
canReadEntryData in class ArchiveInputStream<TarArchiveEntry>archiveEntry - the entry to testArchiveEntry is an instance of TarArchiveEntrypublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.FilterInputStreamjava.io.IOException - on errorpublic TarArchiveEntry getCurrentEntry()
public TarArchiveEntry getNextEntry() throws java.io.IOException
getNextEntry in class ArchiveInputStream<TarArchiveEntry>null if there are no more entriesjava.io.IOException - if the next entry could not be read@Deprecated public TarArchiveEntry getNextTarEntry() throws java.io.IOException
getNextEntry().java.io.IOException - on errorpublic int getRecordSize()
public void mark(int markLimit)
mark in class ArchiveInputStream<TarArchiveEntry>markLimit - The limit to mark.public boolean markSupported()
markSupported in class ArchiveInputStream<TarArchiveEntry>public int read(byte[] buf,
int offset,
int numToRead)
throws java.io.IOException
This method is aware of the boundaries of the current entry in the archive and will deal with them as if they were this stream's start and EOF.
read in class java.io.FilterInputStreambuf - The buffer into which to place bytes read.offset - The offset at which to place bytes read.numToRead - The number of bytes to read.java.io.IOException - on errorpublic void reset()
reset in class ArchiveInputStream<TarArchiveEntry>public long skip(long n)
throws java.io.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 java.io.FilterInputStreamn - the number of bytes to be skipped.java.io.IOException - if a truncated tar archive is detected or some other I/O error occursCopyright © 2010 - 2024 Adobe. All Rights Reserved