|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.io.InputStream
org.apache.commons.compress.archivers.ArchiveInputStream
org.apache.commons.compress.archivers.tar.TarArchiveInputStream
public class TarArchiveInputStream
The TarInputStream reads a UNIX tar archive as an InputStream. methods are provided to position at each successive entry in the archive, and the read each entry as a normal input stream using read().
| Field Summary | |
|---|---|
protected org.apache.commons.compress.archivers.tar.TarBuffer |
buffer
|
| Constructor Summary | |
|---|---|
TarArchiveInputStream(InputStream is)
Constructor for TarInputStream. |
|
TarArchiveInputStream(InputStream is,
int blockSize)
Constructor for TarInputStream. |
|
TarArchiveInputStream(InputStream is,
int blockSize,
int recordSize)
Constructor for TarInputStream. |
|
| Method Summary | |
|---|---|
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. |
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. |
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. |
| Methods inherited from class org.apache.commons.compress.archivers.ArchiveInputStream |
|---|
count, count, getBytesRead, getCount, pushedBackBytes, read |
| Methods inherited from class java.io.InputStream |
|---|
mark, markSupported, read |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.compress.archivers.tar.TarBuffer buffer
| Constructor Detail |
|---|
public TarArchiveInputStream(InputStream is)
is - the input stream to use
public TarArchiveInputStream(InputStream is,
int blockSize)
is - the input stream to useblockSize - the block size to use
public TarArchiveInputStream(InputStream is,
int blockSize,
int recordSize)
is - the input stream to useblockSize - the block size to userecordSize - the record size to use| Method Detail |
|---|
public void close()
throws IOException
close in interface Closeableclose in class InputStreamIOException - on errorpublic int getRecordSize()
public int available()
throws IOException
available in class InputStreamIOException - for signature
public long skip(long numToSkip)
throws IOException
skip in class InputStreamnumToSkip - The number of bytes to skip.
IOException - on errorpublic void reset()
reset in class InputStream
public TarArchiveEntry getNextTarEntry()
throws IOException
IOException - on error
public ArchiveEntry getNextEntry()
throws IOException
ArchiveInputStream
getNextEntry in class ArchiveInputStreamnull if there are no more entries
IOException - if the next entry could not be read
public 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)
May return false if the current entry is a sparse file.
canReadEntryData in class ArchiveInputStreamprotected 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||