Class JPEGHuffmanTable
java.lang.Object
javax.imageio.plugins.jpeg.JPEGHuffmanTable
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
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionJPEGHuffmanTable
(short[] lengths, short[] values) Creates a Huffman table and initializes it. -
Method Summary
Modifier and TypeMethodDescriptionshort[]
Returns an array ofshort
s containing the number of values for each length in the Huffman table.short[]
Returns an array ofshort
s containing the values arranged by increasing length of their corresponding codes.toString()
Returns aString
representing this Huffman table.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Modifier and TypeMethodDescriptionprotected Object
clone()
Creates and returns a copy of this object.boolean
Indicates whether some other object is "equal to" this one.protected void
finalize()
Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class
<?> getClass()
Returns the runtime class of thisObject
.int
hashCode()
Returns a hash code value for this object.final void
notify()
Wakes up a single thread that is waiting on this object's monitor.final void
Wakes up all threads that are waiting on this object's monitor.final void
wait()
Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final void
wait
(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final void
wait
(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.
-
Field Details
-
StdDCLuminance
The standard DC luminance Huffman table. -
StdDCChrominance
The standard DC chrominance Huffman table. -
StdACLuminance
The standard AC luminance Huffman table. -
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 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 Details
-
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
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:
-
toString
-