public class BZip2CompressorInputStream extends CompressorInputStream implements BZip2Constants, InputStreamStatistics
Modifier and Type | Class and Description |
---|---|
private static class |
BZip2CompressorInputStream.Data |
Modifier and Type | Field and Description |
---|---|
private BitInputStream |
bin |
private boolean |
blockRandomised |
private int |
blockSize100k
always: in the range 0 ..
|
private int |
computedBlockCRC |
private int |
computedCombinedCRC |
private CRC |
crc |
private int |
currentState |
private BZip2CompressorInputStream.Data |
data
All memory intensive stuff.
|
private boolean |
decompressConcatenated |
private static int |
EOF |
private int |
last
Index of the last char in the block, so the block size == last + 1.
|
private int |
nInUse |
private static int |
NO_RAND_PART_A_STATE |
private static int |
NO_RAND_PART_B_STATE |
private static int |
NO_RAND_PART_C_STATE |
private int |
origPtr
Index in zptr[] of original string after sorting.
|
private static int |
RAND_PART_A_STATE |
private static int |
RAND_PART_B_STATE |
private static int |
RAND_PART_C_STATE |
private static int |
START_BLOCK_STATE |
private int |
storedBlockCRC |
private int |
storedCombinedCRC |
private int |
su_ch2 |
private int |
su_chPrev |
private int |
su_count |
private int |
su_i2 |
private int |
su_j2 |
private int |
su_rNToGo |
private int |
su_rTPos |
private int |
su_tPos |
private char |
su_z |
BASEBLOCKSIZE, G_SIZE, MAX_ALPHA_SIZE, MAX_CODE_LEN, MAX_SELECTORS, N_GROUPS, N_ITERS, NUM_OVERSHOOT_BYTES, RUNA, RUNB
Constructor and Description |
---|
BZip2CompressorInputStream(java.io.InputStream in)
Constructs a new BZip2CompressorInputStream which decompresses bytes
read from the specified stream.
|
BZip2CompressorInputStream(java.io.InputStream in,
boolean decompressConcatenated)
Constructs a new BZip2CompressorInputStream which decompresses bytes
read from the specified stream.
|
Modifier and Type | Method and Description |
---|---|
private static boolean |
bsGetBit(BitInputStream bin) |
private static int |
bsGetInt(BitInputStream bin) |
private static char |
bsGetUByte(BitInputStream bin) |
private static int |
bsR(BitInputStream bin,
int n)
read bits from the input stream
|
private static void |
checkBounds(int checkVal,
int limitExclusive,
java.lang.String name) |
void |
close() |
private boolean |
complete() |
private void |
createHuffmanDecodingTables(int alphaSize,
int nGroups)
Called by recvDecodingTables() exclusively.
|
private void |
endBlock() |
private void |
getAndMoveToFrontDecode() |
private int |
getAndMoveToFrontDecode0() |
long |
getCompressedCount() |
private static void |
hbCreateDecodeTables(int[] limit,
int[] base,
int[] perm,
char[] length,
int minLen,
int maxLen,
int alphaSize)
Called by createHuffmanDecodingTables() exclusively.
|
private boolean |
init(boolean isFirstStream) |
private void |
initBlock() |
private void |
makeMaps() |
static boolean |
matches(byte[] signature,
int length)
Checks if the signature matches what is expected for a bzip2 file.
|
int |
read() |
int |
read(byte[] dest,
int offs,
int len) |
private int |
read0() |
private int |
readNextByte(BitInputStream in) |
private void |
recvDecodingTables() |
private int |
setupBlock() |
private int |
setupNoRandPartA() |
private int |
setupNoRandPartB() |
private int |
setupNoRandPartC() |
private int |
setupRandPartA() |
private int |
setupRandPartB() |
private int |
setupRandPartC() |
count, count, getBytesRead, getCount, getUncompressedCount, pushedBackBytes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getUncompressedCount
private int last
private int origPtr
private int blockSize100k
private boolean blockRandomised
private final CRC crc
private int nInUse
private BitInputStream bin
private final boolean decompressConcatenated
private static final int EOF
private static final int START_BLOCK_STATE
private static final int RAND_PART_A_STATE
private static final int RAND_PART_B_STATE
private static final int RAND_PART_C_STATE
private static final int NO_RAND_PART_A_STATE
private static final int NO_RAND_PART_B_STATE
private static final int NO_RAND_PART_C_STATE
private int currentState
private int storedBlockCRC
private int storedCombinedCRC
private int computedBlockCRC
private int computedCombinedCRC
private int su_count
private int su_ch2
private int su_chPrev
private int su_i2
private int su_j2
private int su_rNToGo
private int su_rTPos
private int su_tPos
private char su_z
private BZip2CompressorInputStream.Data data
public BZip2CompressorInputStream(java.io.InputStream in) throws java.io.IOException
in
- the InputStream from which this object should be createdjava.io.IOException
- if the stream content is malformed or an I/O error occurs.java.lang.NullPointerException
- if in == null
public BZip2CompressorInputStream(java.io.InputStream in, boolean decompressConcatenated) throws java.io.IOException
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 streamjava.io.IOException
- if in == null
, the stream content is malformed, or an I/O error occurs.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 long getCompressedCount()
getCompressedCount
in interface InputStreamStatistics
private void makeMaps()
private int read0() throws java.io.IOException
java.io.IOException
private int readNextByte(BitInputStream in) throws java.io.IOException
java.io.IOException
private boolean init(boolean isFirstStream) throws java.io.IOException
java.io.IOException
private void initBlock() throws java.io.IOException
java.io.IOException
private void endBlock() throws java.io.IOException
java.io.IOException
private boolean complete() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
private static int bsR(BitInputStream bin, int n) throws java.io.IOException
n
- the number of bits to read, must not exceed 32?java.io.IOException
private static boolean bsGetBit(BitInputStream bin) throws java.io.IOException
java.io.IOException
private static char bsGetUByte(BitInputStream bin) throws java.io.IOException
java.io.IOException
private static int bsGetInt(BitInputStream bin) throws java.io.IOException
java.io.IOException
private static void checkBounds(int checkVal, int limitExclusive, java.lang.String name) throws java.io.IOException
java.io.IOException
private static void hbCreateDecodeTables(int[] limit, int[] base, int[] perm, char[] length, int minLen, int maxLen, int alphaSize) throws java.io.IOException
java.io.IOException
private void recvDecodingTables() throws java.io.IOException
java.io.IOException
private void createHuffmanDecodingTables(int alphaSize, int nGroups) throws java.io.IOException
java.io.IOException
private void getAndMoveToFrontDecode() throws java.io.IOException
java.io.IOException
private int getAndMoveToFrontDecode0() throws java.io.IOException
java.io.IOException
private int setupBlock() throws java.io.IOException
java.io.IOException
private int setupRandPartA() throws java.io.IOException
java.io.IOException
private int setupNoRandPartA() throws java.io.IOException
java.io.IOException
private int setupRandPartB() throws java.io.IOException
java.io.IOException
private int setupRandPartC() throws java.io.IOException
java.io.IOException
private int setupNoRandPartB() throws java.io.IOException
java.io.IOException
private int setupNoRandPartC() throws java.io.IOException
java.io.IOException
public static boolean matches(byte[] signature, int length)
signature
- the bytes to checklength
- the number of bytes to check