class HuffmanDecoder
extends java.lang.Object
implements java.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
private static class |
HuffmanDecoder.BinaryTreeNode |
private static class |
HuffmanDecoder.DecoderState |
private static class |
HuffmanDecoder.DecodingMemory |
private class |
HuffmanDecoder.HuffmanCodes |
private class |
HuffmanDecoder.InitialState |
private class |
HuffmanDecoder.UncompressedState |
| Modifier and Type | Field and Description |
|---|---|
private static int[] |
CODE_LENGTHS_ORDER
When using dynamic huffman codes the order in which the values are stored
follows the positioning below
|
private static int[] |
DISTANCE_TABLE
--------------------------------------------------------------------
idx xtra dist idx xtra dist idx xtra dist
--------------------------------------------------------------------
0 0 1 10 4 33-48 20 9 1025-1536
1 0 2 11 4 49-64 21 9 1537-2048
2 0 3 12 5 65-96 22 10 2049-3072
3 0 4 13 5 97-128 23 10 3073-4096
4 1 5,6 14 6 129-192 24 11 4097-6144
5 1 7,8 15 6 193-256 25 11 6145-8192
6 2 9-12 16 7 257-384 26 12 8193-12288
7 2 13-16 17 7 385-512 27 12 12289-16384
8 3 17-24 18 8 513-768 28 13 16385-24576
9 3 25-32 19 8 769-1024 29 13 24577-32768
30 14 32769-49152
31 14 49153-65536
--------------------------------------------------------------------
|
private boolean |
finalBlock |
private static int[] |
FIXED_DISTANCE |
private static int[] |
FIXED_LITERALS
Huffman Fixed Literal / Distance tables for mode 1
|
private java.io.InputStream |
in |
private HuffmanDecoder.DecodingMemory |
memory |
private BitInputStream |
reader |
private static short[] |
RUN_LENGTH_TABLE
--------------------------------------------------------------------
idx xtra base idx xtra base idx xtra base
--------------------------------------------------------------------
257 0 3 267 1 15,16 277 4 67-82
258 0 4 268 1 17,18 278 4 83-98
259 0 5 269 2 19-22 279 4 99-114
260 0 6 270 2 23-26 280 4 115-130
261 0 7 271 2 27-30 281 5 131-162
262 0 8 272 2 31-34 282 5 163-194
263 0 9 273 3 35-42 283 5 195-226
264 0 10 274 3 43-50 284 5 227-257
265 1 11,12 275 3 51-58 285 16 3
266 1 13,14 276 3 59-66
--------------------------------------------------------------------
|
private HuffmanDecoder.DecoderState |
state |
| Constructor and Description |
|---|
HuffmanDecoder(java.io.InputStream in) |
| Modifier and Type | Method and Description |
|---|---|
(package private) int |
available() |
private static HuffmanDecoder.BinaryTreeNode |
buildTree(int[] litTable) |
void |
close() |
int |
decode(byte[] b) |
int |
decode(byte[] b,
int off,
int len) |
(package private) long |
getBytesRead() |
private static int[] |
getCodes(int[] litTable) |
private static int |
nextSymbol(BitInputStream reader,
HuffmanDecoder.BinaryTreeNode tree) |
private static void |
populateDynamicTables(BitInputStream reader,
int[] literals,
int[] distances) |
private static long |
readBits(BitInputStream reader,
int numBits) |
private long |
readBits(int numBits) |
private int[][] |
readDynamicTables() |
private void |
switchToUncompressedState() |
private static final short[] RUN_LENGTH_TABLE
-------------------------------------------------------------------- idx xtra base idx xtra base idx xtra base -------------------------------------------------------------------- 257 0 3 267 1 15,16 277 4 67-82 258 0 4 268 1 17,18 278 4 83-98 259 0 5 269 2 19-22 279 4 99-114 260 0 6 270 2 23-26 280 4 115-130 261 0 7 271 2 27-30 281 5 131-162 262 0 8 272 2 31-34 282 5 163-194 263 0 9 273 3 35-42 283 5 195-226 264 0 10 274 3 43-50 284 5 227-257 265 1 11,12 275 3 51-58 285 16 3 266 1 13,14 276 3 59-66 --------------------------------------------------------------------value = (base of run length) << 5 | (number of extra bits to read)
private static final int[] DISTANCE_TABLE
-------------------------------------------------------------------- idx xtra dist idx xtra dist idx xtra dist -------------------------------------------------------------------- 0 0 1 10 4 33-48 20 9 1025-1536 1 0 2 11 4 49-64 21 9 1537-2048 2 0 3 12 5 65-96 22 10 2049-3072 3 0 4 13 5 97-128 23 10 3073-4096 4 1 5,6 14 6 129-192 24 11 4097-6144 5 1 7,8 15 6 193-256 25 11 6145-8192 6 2 9-12 16 7 257-384 26 12 8193-12288 7 2 13-16 17 7 385-512 27 12 12289-16384 8 3 17-24 18 8 513-768 28 13 16385-24576 9 3 25-32 19 8 769-1024 29 13 24577-32768 30 14 32769-49152 31 14 49153-65536 --------------------------------------------------------------------value = (base of distance) << 4 | (number of extra bits to read)
private static final int[] CODE_LENGTHS_ORDER
private static final int[] FIXED_LITERALS
private static final int[] FIXED_DISTANCE
private boolean finalBlock
private HuffmanDecoder.DecoderState state
private BitInputStream reader
private final java.io.InputStream in
private final HuffmanDecoder.DecodingMemory memory
public void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic int decode(byte[] b)
throws java.io.IOException
java.io.IOExceptionpublic int decode(byte[] b,
int off,
int len)
throws java.io.IOException
java.io.IOExceptionlong getBytesRead()
private void switchToUncompressedState()
throws java.io.IOException
java.io.IOExceptionprivate int[][] readDynamicTables()
throws java.io.IOException
java.io.IOExceptionint available()
throws java.io.IOException
java.io.IOExceptionprivate static int nextSymbol(BitInputStream reader, HuffmanDecoder.BinaryTreeNode tree) throws java.io.IOException
java.io.IOExceptionprivate static void populateDynamicTables(BitInputStream reader, int[] literals, int[] distances) throws java.io.IOException
java.io.IOExceptionprivate static HuffmanDecoder.BinaryTreeNode buildTree(int[] litTable)
private static int[] getCodes(int[] litTable)
private long readBits(int numBits)
throws java.io.IOException
java.io.IOExceptionprivate static long readBits(BitInputStream reader, int numBits) throws java.io.IOException
java.io.IOException