public abstract class ArchiveInputStream extends 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.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.
|
available, close, mark, markSupported, read, read, reset, skip
public ArchiveInputStream()
public abstract ArchiveEntry getNextEntry() throws IOException
null
if there are no more entriesIOException
- if the next entry could not be readpublic int read() throws 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 InputStream
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 testCopyright © 2016 The Apache Software Foundation. All rights reserved.