java.lang.Object
javax.imageio.plugins.jpeg.JPEGHuffmanTable
public class JPEGHuffmanTable extends Object
A class encapsulating a single JPEG Huffman table.
 Fields are provided for the "standard" tables taken
 from Annex K of the JPEG specification.
 These are the tables used as defaults.
 
For more information about the operation of the standard JPEG plug-in, see the JPEG metadata format specification and usage notes
- 
Field SummaryFields Modifier and Type Field Description static JPEGHuffmanTableStdACChrominanceThe standard AC chrominance Huffman table.static JPEGHuffmanTableStdACLuminanceThe standard AC luminance Huffman table.static JPEGHuffmanTableStdDCChrominanceThe standard DC chrominance Huffman table.static JPEGHuffmanTableStdDCLuminanceThe standard DC luminance Huffman table.
- 
Constructor SummaryConstructors Constructor Description JPEGHuffmanTable(short[] lengths, short[] values)Creates a Huffman table and initializes it.
- 
Method SummaryModifier and Type Method Description short[]getLengths()Returns an array ofshorts containing the number of values for each length in the Huffman table.short[]getValues()Returns an array ofshorts containing the values arranged by increasing length of their corresponding codes.StringtoString()Returns aStringrepresenting this Huffman table.
- 
Field Details- 
StdDCLuminanceThe standard DC luminance Huffman table.
- 
StdDCChrominanceThe standard DC chrominance Huffman table.
- 
StdACLuminanceThe standard AC luminance Huffman table.
- 
StdACChrominanceThe standard AC chrominance Huffman table.
 
- 
- 
Constructor Details- 
JPEGHuffmanTablepublic JPEGHuffmanTable(short[] lengths, short[] values)Creates a Huffman table and initializes it. The input arrays are copied. The arrays must describe a possible Huffman table. For example, 3 codes cannot be expressed with a single bit.- Parameters:
- lengths- an array of- shorts where- lengths[k]is equal to the number of values with corresponding codes of length- k + 1bits.
- values- an array of shorts containing the values in order of increasing code length.
- Throws:
- IllegalArgumentException- if- lengthsor- valuesare null, the length of- lengthsis greater than 16, the length of- valuesis greater than 256, if any value in- lengthsor- valuesis less than zero, or if the arrays do not describe a valid Huffman table.
 
 
- 
- 
Method Details- 
getLengthspublic short[] getLengths()Returns an array ofshorts containing the number of values for each length in the Huffman table. The returned array is a copy.- Returns:
- a shortarray wherearray[k-1]is equal to the number of values in the table of lengthk.
- See Also:
- getValues()
 
- 
getValuespublic short[] getValues()Returns an array ofshorts containing the values arranged by increasing length of their corresponding codes. The interpretation of the array is dependent on the values returned fromgetLengths. The returned array is a copy.- Returns:
- a shortarray of values.
- See Also:
- getLengths()
 
- 
toStringReturns aStringrepresenting this Huffman table.
 
-