|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.web3d.vrml.export.compressors.CodeInputUnpacker
Unpacks N bit codes from source bytes, provided as either an array or stream. N may be more or less than (or equal) to 8 bits, and may be as much as 16 bits, and of course must be what was actually packed.
Since code width N may be greater than 8, unpacked codes are always returned as ints. Packing order as shown for some widths:
Width = 12 x 2 codes = 8 x 3 |BA987654| |3210/BA98| |76543210| Width = 10 x 4 codes = 8 x 5 |98765432| |10/987654| |3210/9876| |543210/98| |76543210| Width = 8, |76543210| Width = 7 x 8 codes = 8 x 7 |6543210/6| |543210/65| |43210/654| |3210/6543| |210/65432| |10/654321| |0/6543210| Width = 6 x 4 codes = 8 x 3 |543210/54| |3210/5432| |10/543210|
| Constructor Summary | |
CodeInputUnpacker(byte[] bytes)
Constructor from array of packed bytes, for default code width. |
|
CodeInputUnpacker(byte[] bytes,
int N)
Constructor from array of packed bytes. |
|
CodeInputUnpacker(java.io.InputStream stream)
Constructor from input stream of packed bytes, for default code width. |
|
CodeInputUnpacker(java.io.InputStream stream,
int N)
Constructor from input stream of packed bytes. |
|
| Method Summary | |
boolean |
atEnd()
True when no more codes available Note that for some code widths, packing may result in the appearance of one or more final codes, which actually are empty fill in the final byte. |
int |
fillNArray(int[] codearray)
Fill (or partly fill) a given array with N bit codes, according to set or default code width, which of course must be what was actually packed. |
int |
getN()
Get next N bit code, according to set or default code width, which of course must be what was actually packed. |
int[] |
getNArray(int maxcodes)
Get array of all N bit codes, according to set or default code width, which of course must be what was actually packed. |
void |
reset()
Doing reset () on Unpacker means use buffer from the top, the assumption is that it has different data in it now. |
void |
setWidth(int width)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public CodeInputUnpacker(byte[] bytes)
bytes - the data array.public CodeInputUnpacker(java.io.InputStream stream)
stream - the data stream.
public CodeInputUnpacker(byte[] bytes,
int N)
bytes - the data array.N - the expected code width in bits,
which of course must be what was actually packed.
public CodeInputUnpacker(java.io.InputStream stream,
int N)
stream - the data stream.N - the expected code width in bits,
which of course must be what was actually packed.| Method Detail |
public void setWidth(int width)
public int getN()
throws java.io.IOException
Since code width N may be greater than 8, unpacked codes are always returned as ints.
java.io.IOException - possible only if based on a stream.
public int[] getNArray(int maxcodes)
throws java.io.IOException
Since code width N may be greater than 8, unpacked codes are always returned as ints.
maxcodes - maximum number of codes expected.
Any codes beyond this length will be discarded!
java.io.IOException - possible only if based on a stream.
public int fillNArray(int[] codearray)
throws java.io.IOException
Since code width N may be greater than 8, unpacked codes are always returned as ints.
codearray - array to fill sized for maximum number of codes expected.
Any codes beyond this length will be discarded!
java.io.IOException - possible only if based on a stream.public void reset()
public boolean atEnd()
throws java.io.IOException
java.io.IOException - possible only if based on a stream.
|
Xj3D VRML/X3D Code API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||