|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream org.apache.tools.bzip2.CBZip2InputStream
public class CBZip2InputStream
An input stream that decompresses from the BZip2 format (without the file header chars) to be read as any other stream.
The decompression requires large amounts of memory. Thus you
should call the close()
method as soon as
possible, to force CBZip2InputStream to release the
allocated memory. See CBZip2OutputStream
for information about memory usage.
CBZip2InputStream reads bytes from the compressed
source stream via the single byte read()
method exclusively. Thus you should consider to use a
buffered source stream.
Instances of this class are not threadsafe.
Field Summary |
---|
Fields inherited from interface org.apache.tools.bzip2.BZip2Constants |
---|
baseBlockSize, G_SIZE, MAX_ALPHA_SIZE, MAX_CODE_LEN, MAX_SELECTORS, N_GROUPS, N_ITERS, NUM_OVERSHOOT_BYTES, rNums, RUNA, RUNB |
Constructor Summary | |
---|---|
CBZip2InputStream(java.io.InputStream in)
Constructs a new CBZip2InputStream which decompresses bytes read from the specified stream. |
|
CBZip2InputStream(java.io.InputStream in,
boolean decompressConcatenated)
Constructs a new CBZip2InputStream which decompresses bytes read from the specified stream. |
Method Summary | |
---|---|
void |
close()
|
int |
read()
|
int |
read(byte[] dest,
int offs,
int len)
|
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CBZip2InputStream(java.io.InputStream in) throws java.io.IOException
Although BZip2 headers are marked with the magic "Bz" this constructor expects the next byte in the stream to be the first one after the magic. Thus callers have to skip the first two bytes. Otherwise this constructor will throw an exception.
java.io.IOException
- if the stream content is malformed or an I/O error occurs.
java.lang.NullPointerException
- if in == nullpublic CBZip2InputStream(java.io.InputStream in, boolean decompressConcatenated) throws java.io.IOException
Although BZip2 headers are marked with the magic "Bz" this constructor expects the next byte in the stream to be the first one after the magic. Thus callers have to skip the first two bytes. Otherwise this constructor will throw an exception.
in
- the InputStream from which this object should be createddecompressConcatenated
- if true, decompress until the end of the input;
if false, stop after the first .bz2 stream and
leave the input position to point to the next
byte after the .bz2 stream
java.io.IOException
- if the stream content is malformed or an I/O error occurs.
java.lang.NullPointerException
- if in == nullMethod Detail |
---|
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] dest, int offs, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |