- 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 Summary
Fields Modifier and Type Field and Description static JPEGHuffmanTable
StdACChrominance
The standard AC chrominance Huffman table.static JPEGHuffmanTable
StdACLuminance
The standard AC luminance Huffman table.static JPEGHuffmanTable
StdDCChrominance
The standard DC chrominance Huffman table.static JPEGHuffmanTable
StdDCLuminance
The standard DC luminance Huffman table.
-
Constructor Summary
Constructors Constructor and Description JPEGHuffmanTable(short[] lengths, short[] values)
Creates a Huffman table and initializes it.
-
Method Summary
Methods Modifier and Type Method and Description short[]
getLengths()
Returns an array ofshort
s containing the number of values for each length in the Huffman table.short[]
getValues()
Returns an array ofshort
s containing the values arranged by increasing length of their corresponding codes.String
toString()
Returns aString
representing this Huffman table.
-
-
-
Field Detail
-
StdDCLuminance
public static final JPEGHuffmanTable StdDCLuminance
The standard DC luminance Huffman table.
-
StdDCChrominance
public static final JPEGHuffmanTable StdDCChrominance
The standard DC chrominance Huffman table.
-
StdACLuminance
public static final JPEGHuffmanTable StdACLuminance
The standard AC luminance Huffman table.
-
StdACChrominance
public static final JPEGHuffmanTable StdACChrominance
The standard AC chrominance Huffman table.
-
-
Constructor Detail
-
JPEGHuffmanTable
public 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 ofshort
s wherelengths[k]
is equal to the number of values with corresponding codes of lengthk + 1
bits.values
- an array of shorts containing the values in order of increasing code length.- Throws:
IllegalArgumentException
- iflengths
orvalues
are null, the length oflengths
is greater than 16, the length ofvalues
is greater than 256, if any value inlengths
orvalues
is less than zero, or if the arrays do not describe a valid Huffman table.
-
-
Method Detail
-
getLengths
public short[] getLengths()
Returns an array ofshort
s containing the number of values for each length in the Huffman table. The returned array is a copy.- Returns:
- a
short
array wherearray[k-1]
is equal to the number of values in the table of lengthk
. - See Also:
getValues()
-
getValues
public short[] getValues()
Returns an array ofshort
s 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
short
array of values. - See Also:
getLengths()
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/imageio/plugins/jpeg/jpeghuffmantable.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.