Class BZip2CompressorInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.compressors.CompressorInputStream
org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,InputStreamStatistics
public class BZip2CompressorInputStream
extends CompressorInputStream
implements InputStreamStatistics
An input stream that decompresses from the BZip2 format to be read as any other stream.
- This class is not thread-safe
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Constant 100000.static final int
Constant 50.static final int
Constant 258.static final int
Constant 23.static final int
Constant 18002.static final int
Constant 6.static final int
Constant 4.static final int
Constant 20.static final int
Constant 0.static final int
Constant 1. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream.BZip2CompressorInputStream
(InputStream in, boolean decompressConcatenated) Constructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream. -
Method Summary
Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream
count, count, getBytesRead, getCount, getUncompressedCount, pushedBackBytes
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
Methods inherited from interface org.apache.commons.compress.utils.InputStreamStatistics
getUncompressedCount
-
Field Details
-
BASEBLOCKSIZE
static final int BASEBLOCKSIZEConstant 100000.- See Also:
-
MAX_ALPHA_SIZE
static final int MAX_ALPHA_SIZEConstant 258.- See Also:
-
MAX_CODE_LEN
static final int MAX_CODE_LENConstant 23.- See Also:
-
RUNA
static final int RUNAConstant 0.- See Also:
-
RUNB
static final int RUNBConstant 1.- See Also:
-
N_GROUPS
static final int N_GROUPSConstant 6.- See Also:
-
G_SIZE
static final int G_SIZEConstant 50.- See Also:
-
N_ITERS
static final int N_ITERSConstant 4.- See Also:
-
MAX_SELECTORS
static final int MAX_SELECTORSConstant 18002.- See Also:
-
NUM_OVERSHOOT_BYTES
static final int NUM_OVERSHOOT_BYTESConstant 20.- See Also:
-
-
Constructor Details
-
BZip2CompressorInputStream
Constructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream. This doesn't support decompressing concatenated .bz2 files.- Parameters:
in
- the InputStream from which this object should be created- Throws:
IOException
- if the stream content is malformed or an I/O error occurs.NullPointerException
- ifin == null
-
BZip2CompressorInputStream
public BZip2CompressorInputStream(InputStream in, boolean decompressConcatenated) throws IOException Constructs a new BZip2CompressorInputStream which decompresses bytes read from the specified stream.- Parameters:
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- Throws:
IOException
- ifin == null
, the stream content is malformed, or an I/O error occurs.
-
-
Method Details
-
matches
Checks if the signature matches what is expected for a bzip2 file.- Parameters:
signature
- the bytes to checklength
- the number of bytes to check- Returns:
- true, if this stream is a bzip2 compressed stream, false otherwise
- Since:
- 1.1
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
getCompressedCount
Description copied from interface:InputStreamStatistics
Gets the amount of raw or compressed bytes read by the stream.- Specified by:
getCompressedCount
in interfaceInputStreamStatistics
- Returns:
- the amount of raw or compressed bytes read by the stream.
- Since:
- 1.17
-
read
- Specified by:
read
in classInputStream
- Throws:
IOException
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-