public class HuffmanDecoder extends Object
A class to implement Huffman decoding as used by the SCP-ECG standard.
DefaultHuffmanTable,
HuffmanTable| Constructor and Description |
|---|
HuffmanDecoder(byte[] bytesToDecompress,
int differenceDataUsed,
int multiplier,
int numberOfHuffmanTables,
ArrayList huffmanTablesList)
Construct a Huffman decoder for the supplied encoded data, as read from an SCP-ECG file.
|
| Modifier and Type | Method and Description |
|---|---|
short |
decode()
Decode a single value.
|
short[] |
decode(int nValuesWanted)
Decode a specified number of values.
|
static void |
main(String[] arg)
For testing.
|
String |
toString()
Dump the current decoder state as a
String. |
public HuffmanDecoder(byte[] bytesToDecompress,
int differenceDataUsed,
int multiplier,
int numberOfHuffmanTables,
ArrayList huffmanTablesList)
Construct a Huffman decoder for the supplied encoded data, as read from an SCP-ECG file.
bytesToDecompress - the compressed datadifferenceDataUsed - 0 = no, 1 = 1 difference value, 2 = 2 difference valuesmultiplier - a value by which to scale the decoded valuesnumberOfHuffmanTables - how many tables are available for usehuffmanTablesList - the Huffman tables themselvespublic final short decode()
throws Exception
Decode a single value.
Exceptionpublic final short[] decode(int nValuesWanted)
throws Exception
Decode a specified number of values.
nValuesWanted - the number of decoded values wantedExceptionpublic static void main(String[] arg)
For testing.
Decodes the byte stream in the example specified in the SCP-ECG standard.
arg - none