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
short
s where
lengths[k]
is equal to the number of values with
corresponding codes of length
k + 1
bits.
-
values - an array of
short
s 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.