public abstract class LZWDecompresser
This class provides common functionality for the
various LZW implementations in the different file
It's currently used by HDGF and HMEF.
Two good resources on LZW are:
Constructor and Description
protected LZWDecompresser(boolean maskMeansCompressed,
protected abstract int populateDictionary(byte dict)
Populates the dictionary, and returns where in it
to begin writing new codes.
Generally, if the dictionary is pre-populated, then new
codes should be placed at the end of that block.
Equally, if the dictionary is left with all zeros, then
usually the new codes can go in at the start.
protected abstract int adjustDictionaryOffset(int offset)
Adjusts the position offset if needed when looking
something up in the dictionary.
Perform a streaming decompression of the input.
1) Reading a flag byte, the 8 bits of which tell you if the
following 8 codes are compressed our un-compressed
2) Consider the 8 bits in turn
3) If the bit is set, the next code is un-compressed, so
add it to the dictionary and output it
4) If the bit isn't set, then read in the length and start
position in the dictionary, and output the bytes there
5) Loop until we've done all 8 bits, then read in the next