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 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.
|
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 initialisation]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 stringb
- the character that follws the index prefixpublic 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 intooffset
- offset to place expanded datacode
- the code to expand to the byte array it represents.
PRECONDITION This code must allready be in the LZSSskipHead
- 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 © 2015–2022 SCIFIO. All rights reserved.