public class HuffmanDecoder
extends java.lang.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,
java.util.ArrayList huffmanTablesList)
Construct a Huffman decoder for the supplied encoded data, as read from an SCP-ECG file.
|
public HuffmanDecoder(byte[] bytesToDecompress,
int differenceDataUsed,
int multiplier,
int numberOfHuffmanTables,
java.util.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 java.lang.Exception
Decode a single value.
java.lang.Exceptionpublic final short[] decode(int nValuesWanted)
throws java.lang.Exception
Decode a specified number of values.
nValuesWanted - the number of decoded values wantedjava.lang.Exceptionpublic java.lang.String toString()
Dump the current decoder state as a String.
toString in class java.lang.ObjectStringpublic static void main(java.lang.String[] arg)
For testing.
Decodes the byte stream in the example specified in the SCP-ECG standard.
arg - none