public class CBZip2InputStream extends InputStream
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.
Modifier and Type | Class and Description |
---|---|
private static class |
CBZip2InputStream.Data |
Modifier and Type | Field and Description |
---|---|
private static int |
BASE_BLOCK_SIZE |
private boolean |
blockRandomised |
private int |
blockSize100k
always: in the range 0 ..
|
private int |
bsBuff |
private int |
bsLive |
private int |
computedBlockCRC |
private int |
computedCombinedCRC |
private CRC |
crc |
private int |
currentChar |
private int |
currentState |
private CBZip2InputStream.Data |
data
All memory intensive stuff.
|
private static int |
EOF |
private static int |
G_SIZE |
private InputStream |
in |
private int |
last
Index of the last char in the block, so the block size == last + 1.
|
private static org.slf4j.Logger |
LOGGER |
private static int |
MAX_ALPHA_SIZE |
private static int |
MAX_CODE_LEN |
private static int |
MAX_SELECTORS |
private static int |
N_GROUPS |
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[] |
R_NUMS |
private static int |
RAND_PART_A_STATE |
private static int |
RAND_PART_B_STATE |
private static int |
RAND_PART_C_STATE |
private static int |
RUNA |
private static int |
RUNB |
private static int |
START_BLOCK_STATE |
private int |
storedBlockCRC |
private int |
storedCombinedCRC |
private int |
suCh2 |
private int |
suChPrev |
private int |
suCount |
private int |
suI2 |
private int |
suJ2 |
private int |
suRNToGo |
private int |
suRTPos |
private int |
suTPos |
private char |
suZ |
Constructor and Description |
---|
CBZip2InputStream(InputStream in)
Constructs a new CBZip2InputStream 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 void |
complete() |
private void |
createHuffmanDecodingTables(int alphaSize,
int nGroups)
Called by recvDecodingTables() exclusively.
|
private void |
endBlock() |
private void |
getAndMoveToFrontDecode() |
private int |
getAndMoveToFrontDecode0(int groupNo) |
private static void |
hbCreateDecodeTables(int[] limit,
int[] base,
int[] perm,
char[] length,
int minLen,
int maxLen,
int alphaSize)
Called by createHuffmanDecodingTables() exclusively.
|
private void |
init() |
private void |
initBlock() |
private void |
makeMaps() |
int |
read() |
int |
read(byte[] dest,
int offs,
int len) |
private int |
read0() |
private void |
recvDecodingTables() |
private static void |
reportCRCError() |
private void |
setupBlock() |
private void |
setupNoRandPartA() |
private void |
setupNoRandPartB() |
private void |
setupNoRandPartC() |
private void |
setupRandPartA() |
private void |
setupRandPartB() |
private void |
setupRandPartC() |
available, mark, markSupported, read, reset, skip
private static final int BASE_BLOCK_SIZE
private static final int MAX_ALPHA_SIZE
private static final int MAX_CODE_LEN
private static final int RUNA
private static final int RUNB
private static final int N_GROUPS
private static final int G_SIZE
private static final int MAX_SELECTORS
private static final int[] R_NUMS
private static final org.slf4j.Logger LOGGER
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 InputStream in
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 suCount
private int suCh2
private int suChPrev
private int suI2
private int suJ2
private int suRNToGo
private int suRTPos
private int suTPos
private char suZ
private CBZip2InputStream.Data data
public CBZip2InputStream(InputStream in) throws IOException
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.
IOException
- if the stream content is malformed or an I/O error occurs.NullPointerException
- if in == nullprivate static void reportCRCError()
private void makeMaps()
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] dest, int offs, int len) throws IOException
read
in class InputStream
IOException
private int read0() throws IOException
IOException
private void init() throws IOException
IOException
private void initBlock() throws IOException
IOException
private void endBlock()
private void complete() throws IOException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
private int bsR(int n) throws IOException
IOException
private boolean bsGetBit() throws IOException
IOException
private char bsGetUByte() throws IOException
IOException
private int bsGetInt() throws IOException
IOException
private static void hbCreateDecodeTables(int[] limit, int[] base, int[] perm, char[] length, int minLen, int maxLen, int alphaSize)
private void recvDecodingTables() throws IOException
IOException
private void createHuffmanDecodingTables(int alphaSize, int nGroups)
private void getAndMoveToFrontDecode() throws IOException
IOException
private int getAndMoveToFrontDecode0(int groupNo) throws IOException
IOException
private void setupBlock() throws IOException
IOException
private void setupRandPartA() throws IOException
IOException
private void setupNoRandPartA() throws IOException
IOException
private void setupRandPartB() throws IOException
IOException
private void setupRandPartC() throws IOException
IOException
private void setupNoRandPartB() throws IOException
IOException
private void setupNoRandPartC() throws IOException
IOException
Copyright © 2015 Open Microscopy Environment