public class BZip2InputStream extends InputStream
An InputStream wrapper that decompresses BZip2 data
A BZip2 stream consists of one or more blocks of compressed data. This decompressor reads a whole block at a time, then progressively returns decompressed output.
On encountering any error decoding the compressed stream, an IOException is thrown, and
further reads will return -1
Note: Each BZip2 compressed block contains a CRC code which is verified after the block has been read completely. If verification fails, an exception is thrown on the final read from the block, potentially after corrupt data has already been returned. The compressed stream also contains a final CRC code which is verified once the end of the stream has been reached. This check may fail even if every individual block in the stream passes CRC verification. If this possibility is of concern, you should read and store the entire decompressed stream before further processing.
Instances of this class are not threadsafe.
Constructor and Description |
---|
BZip2InputStream(InputStream inputStream,
boolean headerless) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
int |
read() |
int |
read(byte[] destination,
int offset,
int length) |
available, mark, markSupported, read, reset, skip
public BZip2InputStream(InputStream inputStream, boolean headerless)
inputStream
- The InputStream to wrapheaderless
- If true
, the caller is assumed to have read away the stream's
leading "BZ" identifier bytespublic int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] destination, int offset, int length) throws IOException
read
in class InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
Copyright © 2016. All rights reserved.