org.apache.commons.compress.archivers.tar
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.
|
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 numToSkip)
Skip bytes in the input buffer.
|
count, count, getBytesRead, getCount, pushedBackBytes, read
mark, markSupported, 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 class InputStream
IOException
- on errorpublic int getRecordSize()
public int available() throws IOException
available
in class InputStream
IOException
- for signaturepublic long skip(long numToSkip) throws IOException
skip
in class InputStream
numToSkip
- The number of bytes to skip.IOException
- on errorpublic 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
public 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 © 2013 The Apache Software Foundation. All rights reserved.