Package com.pixelmed.scpecg
Class HuffmanDecoder
- java.lang.Object
-
- com.pixelmed.scpecg.HuffmanDecoder
-
public class HuffmanDecoder extends java.lang.ObjectA class to implement Huffman decoding as used by the SCP-ECG standard.
- See Also:
DefaultHuffmanTable,HuffmanTable
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description shortdecode()Decode a single value.short[]decode(int nValuesWanted)Decode a specified number of values.static voidmain(java.lang.String[] arg)For testing.java.lang.StringtoString()Dump the current decoder state as aString.
-
-
-
Constructor Detail
-
HuffmanDecoder
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.
- Parameters:
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 themselves
-
-
Method Detail
-
decode
public final short decode() throws java.lang.ExceptionDecode a single value.
- Returns:
- the decoded value
- Throws:
java.lang.Exception
-
decode
public final short[] decode(int nValuesWanted) throws java.lang.ExceptionDecode a specified number of values.
- Parameters:
nValuesWanted- the number of decoded values wanted- Returns:
- the decoded values
- Throws:
java.lang.Exception
-
toString
public java.lang.String toString()
Dump the current decoder state as a
String.- Overrides:
toStringin classjava.lang.Object- Returns:
- the current decoder state as a
String
-
main
public static void main(java.lang.String[] arg)
For testing.
Decodes the byte stream in the example specified in the SCP-ECG standard.
- Parameters:
arg- none
-
-