Class CBZip2InputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- org.apache.tools.bzip2.CBZip2InputStream
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.lang.AutoCloseable,- BZip2Constants
 
 public class CBZip2InputStream extends java.io.InputStream implements BZip2Constants 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 forceCBZip2InputStreamto release the allocated memory. SeeCBZip2OutputStreamfor information about memory usage.CBZip2InputStreamreads bytes from the compressed source stream via the single byteread()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.BZip2ConstantsbaseBlockSize, G_SIZE, MAX_ALPHA_SIZE, MAX_CODE_LEN, MAX_SELECTORS, N_GROUPS, N_ITERS, NUM_OVERSHOOT_BYTES, rNums, RUNA, RUNB
 
- 
 - 
Constructor SummaryConstructors Constructor Description 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.
 
- 
- 
- 
Constructor Detail- 
CBZip2InputStreampublic CBZip2InputStream(java.io.InputStream in) throws java.io.IOExceptionConstructs a new CBZip2InputStream which decompresses bytes read from the specified stream. This doesn't support decompressing concatenated .bz2 files.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.- Parameters:
- in- InputStream
- Throws:
- java.io.IOException- if the stream content is malformed or an I/O error occurs.
- java.lang.NullPointerException- if- in == null
 
 - 
CBZip2InputStreampublic CBZip2InputStream(java.io.InputStream in, boolean decompressConcatenated) throws java.io.IOExceptionConstructs a new CBZip2InputStream which decompresses bytes read from the specified stream.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.- Parameters:
- in- the InputStream from which this object should be created
- decompressConcatenated- 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
- Throws:
- java.io.IOException- if the stream content is malformed or an I/O error occurs.
- java.lang.NullPointerException- if- in == null
 
 
- 
 - 
Method Detail- 
readpublic int read() throws java.io.IOException- Specified by:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
readpublic int read(byte[] dest, int offs, int len) throws java.io.IOException- Overrides:
- readin class- java.io.InputStream
- Throws:
- java.io.IOException
 
 - 
closepublic void close() throws java.io.IOException- Specified by:
- closein interface- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Overrides:
- closein class- java.io.InputStream
- Throws:
- java.io.IOException
 
 
- 
 
-