public abstract class ArchiveInputStream
extends java.io.InputStream
InputStream.read(byte[], int, int)
- or read()
-
method so that reading from the stream generates EOF for the end of
data in each entry as well as at the end of the file proper.
The getNextEntry()
method is used to reset the input stream
ready for reading the data from the next entry.
The input stream classes must also implement a method with the signature:
public static boolean matches(byte[] signature, int length)which is used by the
ArchiveStreamFactory
to autodetect
the archive type from the first few bytes of a stream.Modifier and Type | Field and Description |
---|---|
private static int |
BYTE_MASK |
private long |
bytesRead
holds the number of bytes read in this stream
|
private byte[] |
single |
Constructor and Description |
---|
ArchiveInputStream() |
Modifier and Type | Method and Description |
---|---|
boolean |
canReadEntryData(ArchiveEntry archiveEntry)
Whether this stream is able to read the given entry.
|
protected void |
count(int read)
Increments the counter of already read bytes.
|
protected void |
count(long read)
Increments the counter of already read bytes.
|
long |
getBytesRead()
Returns the current number of bytes read from this stream.
|
int |
getCount()
Deprecated.
this method may yield wrong results for large
archives, use #getBytesRead instead
|
abstract ArchiveEntry |
getNextEntry()
Returns the next Archive Entry in this Stream.
|
protected void |
pushedBackBytes(long pushedBack)
Decrements the counter of already read bytes.
|
int |
read()
Reads a byte of data.
|
private final byte[] single
private static final int BYTE_MASK
private long bytesRead
public abstract ArchiveEntry getNextEntry() throws java.io.IOException
null
if there are no more entriesjava.io.IOException
- if the next entry could not be readpublic int read() throws java.io.IOException
InputStream.read(byte[], int, int)
method.
MUST be overridden if the InputStream.read(byte[], int, int)
method
is not overridden; may be overridden otherwise.read
in class java.io.InputStream
java.io.IOException
- if an I/O error has occurredprotected void count(int read)
read
- the number of bytes readprotected void count(long read)
read
- the number of bytes readprotected void pushedBackBytes(long pushedBack)
pushedBack
- the number of bytes pushed back.@Deprecated public int getCount()
public long getBytesRead()
public boolean canReadEntryData(ArchiveEntry archiveEntry)
Some archive formats support variants or details that are not supported (yet).
archiveEntry
- the entry to test