Package loci.common
Class CBZip2InputStream
java.lang.Object
java.io.InputStream
loci.common.CBZip2InputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
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 using a buffered source stream.
Instances of this class are not threadsafe.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new CBZip2InputStream which decompresses bytes read from the specified stream. -
Method Summary
Methods inherited from class java.io.InputStream
available, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
CBZip2InputStream
Constructs 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- stream from which to read BZip2 data; expected to be set to the first byte past the 2 byte magic marker- Throws:
IOException- if the stream content is malformed or an I/O error occurs.NullPointerException- ifin == null
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-