public class TarArchiveInputStream extends ArchiveInputStream
Constructor and Description |
---|
TarArchiveInputStream(InputStream is)
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,
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, read
read
public TarArchiveInputStream(InputStream is)
is
- the input stream to usepublic 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 void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
- on errorpublic int getRecordSize()
public int available() throws IOException
available
in class InputStream
IOException
- 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 InputStream
n
- the number of bytes to be skipped.IOException
- if some other I/O error occurs.public boolean markSupported()
markSupported
in class InputStream
public void mark(int markLimit)
mark
in class InputStream
markLimit
- The limit to mark.public void reset()
reset
in class InputStream
public 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 ArchiveInputStream
null
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 InputStream
buf
- 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)
May return false if the current entry is a sparse file.
canReadEntryData
in class ArchiveInputStream
ae
- the entry to testpublic 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 © 2016 The Apache Software Foundation. All rights reserved.