org.apache.commons.compress.archivers.tar
public class TarArchiveInputStream extends ArchiveInputStream
Modifier and Type | Field and Description |
---|---|
protected TarBuffer |
buffer |
private static int |
BUFFER_SIZE |
private TarArchiveEntry |
currEntry |
private long |
entryOffset |
private long |
entrySize |
private boolean |
hasHitEOF |
private byte[] |
readBuf |
private static int |
SMALL_BUFFER_SIZE |
Constructor and Description |
---|
TarArchiveInputStream(java.io.InputStream is)
Constructor for TarInputStream.
|
TarArchiveInputStream(java.io.InputStream is,
int blockSize)
Constructor for TarInputStream.
|
TarArchiveInputStream(java.io.InputStream is,
int blockSize,
int recordSize)
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.
|
void |
close()
Closes this stream.
|
protected TarArchiveEntry |
getCurrentEntry() |
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 TarBuffer.
|
protected boolean |
isAtEOF() |
static boolean |
matches(byte[] signature,
int length)
Checks if the signature matches what is expected for a tar file.
|
private void |
paxHeaders() |
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.
|
protected void |
setAtEOF(boolean b) |
protected void |
setCurrentEntry(TarArchiveEntry e) |
long |
skip(long numToSkip)
Skip bytes in the input buffer.
|
canReadEntryData, count, count, getBytesRead, getCount, pushedBackBytes, read
private static final int SMALL_BUFFER_SIZE
private static final int BUFFER_SIZE
private boolean hasHitEOF
private long entrySize
private long entryOffset
private byte[] readBuf
protected final TarBuffer buffer
private TarArchiveEntry currEntry
public TarArchiveInputStream(java.io.InputStream is)
is
- the input stream to usepublic TarArchiveInputStream(java.io.InputStream is, int blockSize)
is
- the input stream to useblockSize
- the block size to usepublic TarArchiveInputStream(java.io.InputStream is, int blockSize, int recordSize)
is
- the input stream to useblockSize
- the block size to userecordSize
- the record size to usepublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
- on errorpublic int getRecordSize()
public int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
- for signaturepublic long skip(long numToSkip) throws java.io.IOException
skip
in class java.io.InputStream
numToSkip
- The number of bytes to skip.java.io.IOException
- on errorpublic void reset()
reset
in class java.io.InputStream
public TarArchiveEntry getNextTarEntry() throws java.io.IOException
java.io.IOException
- on errorprivate void paxHeaders() throws java.io.IOException
java.io.IOException
public ArchiveEntry getNextEntry() throws java.io.IOException
ArchiveInputStream
getNextEntry
in class ArchiveInputStream
null
if there are no more entriesjava.io.IOException
- if the next entry could not be readpublic int read(byte[] buf, int offset, int numToRead) throws java.io.IOException
read
in class java.io.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.java.io.IOException
- on errorprotected final 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 check