public class LZWStringTable extends Object
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.
Constructor and Description |
---|
LZWStringTable()
Constructor allocate memory for string store data
|
Modifier and Type | Method and Description |
---|---|
int |
AddCharString(short index, byte b) |
void |
ClearTable(int codesize) |
void |
dump(PrintStream out) |
int |
expandCode(byte[] buf, int offset, short code, int skipHead)
If expanded data doesn't 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.
|
short |
FindCharString(short index, byte b) |
static int |
Hash(short index, byte lastbyte) |
public LZWStringTable()
public int AddCharString(short index, byte b)
index
- value of -1 indicates no predecessor [used in initialization]
b
- the byte [character] to add to the string store which follows the predecessor string specified the index.
public short FindCharString(short index, byte b)
index
- index to prefix string
b
- the character that follws the index prefix
public void ClearTable(int codesize)
codesize
- the size of code to be preallocated for the string store.
public static int Hash(short index, byte lastbyte)
public int expandCode(byte[] buf, int offset, short code, int skipHead)
buf
- buffer to place expanded data into
offset
- offset to place expanded data
code
- the code to expand to the byte array it represents. PRECONDITION This code must already be in the LZSS
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 is equal to codeLen.
public void dump(PrintStream out)
Copyright © 1998–2019. All rights reserved.