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, pushedBackBytesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetUncompressedCountprivate 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 == nullpublic 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.InputStreamjava.io.IOExceptionpublic int read(byte[] dest,
int offs,
int len)
throws java.io.IOException
read in class java.io.InputStreamjava.io.IOExceptionpublic long getCompressedCount()
getCompressedCount in interface InputStreamStatisticsprivate void makeMaps()
private int read0()
throws java.io.IOException
java.io.IOExceptionprivate int readNextByte(BitInputStream in) throws java.io.IOException
java.io.IOExceptionprivate boolean init(boolean isFirstStream)
throws java.io.IOException
java.io.IOExceptionprivate void initBlock()
throws java.io.IOException
java.io.IOExceptionprivate void endBlock()
throws java.io.IOException
java.io.IOExceptionprivate boolean complete()
throws java.io.IOException
java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.InputStreamjava.io.IOExceptionprivate static int bsR(BitInputStream bin, int n) throws java.io.IOException
n - the number of bits to read, must not exceed 32?java.io.IOExceptionprivate static boolean bsGetBit(BitInputStream bin) throws java.io.IOException
java.io.IOExceptionprivate static char bsGetUByte(BitInputStream bin) throws java.io.IOException
java.io.IOExceptionprivate static int bsGetInt(BitInputStream bin) throws java.io.IOException
java.io.IOExceptionprivate static void checkBounds(int checkVal,
int limitExclusive,
java.lang.String name)
throws java.io.IOException
java.io.IOExceptionprivate static void hbCreateDecodeTables(int[] limit,
int[] base,
int[] perm,
char[] length,
int minLen,
int maxLen,
int alphaSize)
throws java.io.IOException
java.io.IOExceptionprivate void recvDecodingTables()
throws java.io.IOException
java.io.IOExceptionprivate void createHuffmanDecodingTables(int alphaSize,
int nGroups)
throws java.io.IOException
java.io.IOExceptionprivate void getAndMoveToFrontDecode()
throws java.io.IOException
java.io.IOExceptionprivate int getAndMoveToFrontDecode0()
throws java.io.IOException
java.io.IOExceptionprivate int setupBlock()
throws java.io.IOException
java.io.IOExceptionprivate int setupRandPartA()
throws java.io.IOException
java.io.IOExceptionprivate int setupNoRandPartA()
throws java.io.IOException
java.io.IOExceptionprivate int setupRandPartB()
throws java.io.IOException
java.io.IOExceptionprivate int setupRandPartC()
throws java.io.IOException
java.io.IOExceptionprivate int setupNoRandPartB()
throws java.io.IOException
java.io.IOExceptionprivate int setupNoRandPartC()
throws java.io.IOException
java.io.IOExceptionpublic static boolean matches(byte[] signature,
int length)
signature - the bytes to checklength - the number of bytes to check