javax.imageio.plugins.jpeg
Class JPEGHuffmanTable

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.imageio.plugins.jpeg.JPEGHuffmanTable

public class JPEGHuffmanTable
extends Object sample code for java.lang.Object definition code for java.lang.Object

A class encapsulating a single JPEG Huffman table. Fields are provided for the "standard" tables from taken from Annex K of the JPEG specification. These are the tables used as defaults. This class differs from the old unsupported com.sun.image.codec.jpeg.JPEGHuffmanTable in two ways:

  1. The lengths arrays for this class do not contain an ignored 0th entry. The lengths array in a JPEG stream does not contain an extra entry, and this class is used to represent the contents of a JPEG stream.
  2. The old class incorrectly referred to Huffman "symbols", while expecting an array of values to be encoded. This class has a getValues method instead of a getSymbols method.

For more information about the operation of the built-in JPEG plug-ins, see the JPEG metadata format specification and usage notes.


Field Summary
static JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable StdACChrominance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACChrominance definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACChrominance
          The standard AC chrominance Huffman table.
static JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable StdACLuminance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACLuminance definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACLuminance
          The standard AC luminance Huffman table.
static JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable StdDCChrominance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCChrominance definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCChrominance
          The standard DC chrominance Huffman table.
static JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable StdDCLuminance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCLuminance definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCLuminance
          The standard DC luminance Huffman table.
 
Constructor Summary
JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.JPEGHuffmanTable(short[], short[]) definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.JPEGHuffmanTable(short[], short[]) (short[] lengths, short[] values)
          Creates a Huffman table and initializes it.
 
Method Summary
 short[] getLengths sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths() ()
          Return an array of shorts containing the number of values for each length in the Huffman table.
 short[] getValues sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues() ()
          Return an array of shorts containing the values arranged by increasing length of their corresponding codes.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.toString() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.toString() ()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

StdDCLuminance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCLuminance

public static final JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable  StdDCLuminance
The standard DC luminance Huffman table.


StdDCChrominance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdDCChrominance

public static final JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable  StdDCChrominance
The standard DC chrominance Huffman table.


StdACLuminance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACLuminance

public static final JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable  StdACLuminance
The standard AC luminance Huffman table.


StdACChrominance sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.StdACChrominance

public static final JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable  StdACChrominance
The standard AC chrominance Huffman table.

Constructor Detail

JPEGHuffmanTable sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable(short[], short[]) definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable(short[], short[])

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 of shorts where lengths[k] is equal to the number of values with corresponding codes of length k + 1 bits.
values - an array of shorts containing the values in order of increasing code length.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if lengths or values are null, the length of lengths is greater than 16, the length of values is greater than 256, if any value in lengths or values is less than zero, or if the arrays do not describe a valid Huffman table.
Method Detail

getLengths sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths()

public short[] getLengths()
Return an array of shorts containing the number of values for each length in the Huffman table. The returned array is a copy.

Returns:
a short array where array[k-1] is equal to the number of values in the table of length k.
See Also:
getValues() sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues()

getValues sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getValues()

public short[] getValues()
Return an array of shorts containing the values arranged by increasing length of their corresponding codes. The interpretation of the array is dependent on the values returned from getLengths. The returned array is a copy.

Returns:
a short array of values.
See Also:
getLengths() sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.getLengths()

toString sample code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.toString() definition code for javax.imageio.plugins.jpeg.JPEGHuffmanTable.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Description copied from class: Object sample code for java.lang.Object.toString() definition code for java.lang.Object.toString()
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of the object.