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.
|
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(java.lang.String[] arg)
For testing.
|
java.lang.String |
toString()
Dump the current decoder state as a
String . |
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.Exception
public final short[] decode(int nValuesWanted) throws java.lang.Exception
Decode a specified number of values.
nValuesWanted
- the number of decoded values wantedjava.lang.Exception
public static void main(java.lang.String[] arg)
For testing.
Decodes the byte stream in the example specified in the SCP-ECG standard.
arg
- nonepublic java.lang.String toString()
Dump the current decoder state as a String
.
toString
in class java.lang.Object
String