| java.lang.Object com.sun.media.imageioimpl.common.LZWStringTable
LZWStringTable | public class LZWStringTable (Code) | | General purpose LZW String Table.
Extracted from GIFEncoder by Adam Doppelt
Comments added by Robin Luiten
expandCode added by Robin Luiten
The strLen_ table to give quick access to the lenght of an expanded
code for use by the expandCode method added by Robin.
|
Method Summary | |
public int | AddCharString(short index, byte b) Parameters: index - value of -1 indicates no predecessor [used in initialisation] Parameters: b - the byte [character] to add to the string store which followsthe predecessor string specified the index. | public void | ClearTable(int codesize) | public short | FindCharString(short index, byte b) Parameters: index - index to prefix string Parameters: b - the character that follws the index prefix b if param index is HASH_FREE. | public static int | Hash(short index, byte lastbyte) | public void | dump(PrintStream out) | public int | expandCode(byte[] buf, int offset, short code, int skipHead) If expanded data doesnt fit into array only what will fit is written
to buf and the return value indicates how much of the expanded code has
been written to the buf. |
numStrings_ | short numStrings_(Code) | | |
strLen_ | int[] strLen_(Code) | | each entry corresponds to a code and contains the length of data
that the code expands to when decoded.
|
LZWStringTable | public LZWStringTable()(Code) | | Constructor allocate memory for string store data
|
AddCharString | public int AddCharString(short index, byte b)(Code) | | Parameters: index - value of -1 indicates no predecessor [used in initialisation] Parameters: b - the byte [character] to add to the string store which followsthe predecessor string specified the index. 0xFFFF if no space in table left for addition of predecesorindex and byte b. Else return the code allocated for combination index + b. |
ClearTable | public void ClearTable(int codesize)(Code) | | Parameters: codesize - the size of code to be preallocated for thestring store. |
FindCharString | public short FindCharString(short index, byte b)(Code) | | Parameters: index - index to prefix string Parameters: b - the character that follws the index prefix b if param index is HASH_FREE. Else return the codefor this prefix and byte successor |
Hash | public static int Hash(short index, byte lastbyte)(Code) | | |
expandCode | public int expandCode(byte[] buf, int offset, short code, int skipHead)(Code) | | If expanded data doesnt fit into array only what will fit is written
to buf and the return value indicates how much of the expanded code has
been written to the buf. The next call to expandCode() should be with
the same code and have the skip parameter set the negated value of the
previous return. Succesive negative return values should be negated and
added together for next skip parameter value with same code.
Parameters: buf - buffer to place expanded data into Parameters: offset - offset to place expanded data Parameters: code - the code to expand to the byte array it represents.PRECONDITION This code must allready be in the LZSS Parameters: skipHead - is the number of bytes at the start of the expanded code to be skipped before data is written to buf. It is possible that skipHead isequal to codeLen. the length of data expanded into buf. If the expanded code is longerthan space left in buf then the value returned is a negative number which whennegated is equal to the number of bytes that were used of the code being expanded.This negative value also indicates the buffer is full. |
|
|