Class JPEGHuffmanTable

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
    Description
    static final JPEGHuffmanTable
    The standard AC chrominance Huffman table.
    static final JPEGHuffmanTable
    The standard AC luminance Huffman table.
    static final JPEGHuffmanTable
    The standard DC chrominance Huffman table.
    static final JPEGHuffmanTable
    The standard DC luminance Huffman table.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JPEGHuffmanTable(short[] lengths, short[] values)
    Creates a Huffman table and initializes it.
  • Method Summary

    Modifier and Type
    Method
    Description
    short[]
    Returns an array of shorts containing the number of values for each length in the Huffman table.
    short[]
    Returns an array of shorts containing the values arranged by increasing length of their corresponding codes.
    Returns a String representing this Huffman table.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
  • Field Details

    • 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 Details

    • 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 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 - 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 Details

    • getLengths

      public short[] getLengths()
      Returns 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

      public short[] getValues()
      Returns 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:
    • toString

      public String toString()
      Returns a String representing this Huffman table.
      Overrides:
      toString in class Object
      Returns:
      a String representing this Huffman table.