public class BZip2CompressorInputStream extends java.io.InputStream implements BZip2Constants
Forked from Apache Commons-Compress with possible changes
Modifier and Type | Class and Description |
---|---|
private static class |
BZip2CompressorInputStream.Data |
Modifier and Type | Field and Description |
---|---|
private boolean |
blockRandomised |
private int |
blockSize100k
always: in the range 0 ..
|
private int |
bsBuff |
private int |
bsLive |
private long |
bytesRead |
private int |
computedBlockCRC |
private int |
computedCombinedCRC |
private CRC |
crc |
private int |
currentChar |
private int |
currentState |
private BZip2CompressorInputStream.Data |
data
All memory intensive stuff.
|
private boolean |
decompressConcatenated |
private static int |
EOF |
private java.io.InputStream |
in |
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 boolean |
bsGetBit() |
private int |
bsGetInt() |
private char |
bsGetUByte() |
private int |
bsR(int n) |
void |
close() |
private boolean |
complete() |
protected void |
count(int read)
Increments the counter of already read bytes.
|
protected void |
count(long read)
Increments the counter of already read bytes.
|
private void |
createHuffmanDecodingTables(int alphaSize,
int nGroups)
Called by recvDecodingTables() exclusively.
|
private void |
endBlock() |
private void |
getAndMoveToFrontDecode() |
private int |
getAndMoveToFrontDecode0(int groupNo) |
long |
getBytesRead()
Returns the current number of bytes read from this stream.
|
int |
getCount()
Deprecated.
this method may yield wrong results for large
archives, use #getBytesRead instead
|
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 void |
recvDecodingTables() |
private void |
setupBlock() |
private void |
setupNoRandPartA() |
private void |
setupNoRandPartB() |
private void |
setupNoRandPartC() |
private void |
setupRandPartA() |
private void |
setupRandPartB() |
private void |
setupRandPartC() |
private long bytesRead
private int last
private int origPtr
private int blockSize100k
private boolean blockRandomised
private int bsBuff
private int bsLive
private final CRC crc
private int nInUse
private java.io.InputStream in
private final boolean decompressConcatenated
private int currentChar
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
java.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 the stream content is malformed or an I/O error occurs.java.lang.NullPointerException
- if in == nullprotected void count(int read)
read
- the number of bytes readprotected void count(long read)
read
- the number of bytes read@Deprecated public int getCount()
public long getBytesRead()
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
private void makeMaps()
private int read0() 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 int bsR(int n) throws java.io.IOException
java.io.IOException
private boolean bsGetBit() throws java.io.IOException
java.io.IOException
private char bsGetUByte() throws java.io.IOException
java.io.IOException
private int bsGetInt() 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)
private void recvDecodingTables() throws java.io.IOException
java.io.IOException
private void createHuffmanDecodingTables(int alphaSize, int nGroups)
private void getAndMoveToFrontDecode() throws java.io.IOException
java.io.IOException
private int getAndMoveToFrontDecode0(int groupNo) throws java.io.IOException
java.io.IOException
private void setupBlock() throws java.io.IOException
java.io.IOException
private void setupRandPartA() throws java.io.IOException
java.io.IOException
private void setupNoRandPartA() throws java.io.IOException
java.io.IOException
private void setupRandPartB() throws java.io.IOException
java.io.IOException
private void setupRandPartC() throws java.io.IOException
java.io.IOException
private void setupNoRandPartB() throws java.io.IOException
java.io.IOException
private void 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