public abstract class LZWDecompresser
extends java.lang.Object
Two good resources on LZW are: http://en.wikipedia.org/wiki/LZW http://marknelson.us/1989/10/01/lzw-data-compression/
Modifier and Type | Field and Description |
---|---|
static int |
DICT_MASK
the mask for calculating / wrapping dictionary offsets
|
static int |
DICT_SIZE
the size of our dictionary
|
Modifier | Constructor and Description |
---|---|
protected |
LZWDecompresser(boolean maskMeansCompressed,
int codeLengthIncrease,
boolean positionIsBigEndian) |
Modifier and Type | Method and Description |
---|---|
protected abstract int |
adjustDictionaryOffset(int offset)
Adjusts the position offset if needed when looking
something up in the dictionary.
|
byte[] |
decompress(java.io.InputStream src)
Decompresses the given input stream, returning the array of bytes
of the decompressed input.
|
void |
decompress(java.io.InputStream src,
java.io.OutputStream res)
Perform a streaming decompression of the input.
|
static int |
getMaxRecordLength() |
protected abstract int |
populateDictionary(byte[] dict)
Populates the dictionary, and returns where in it
to begin writing new codes.
|
static void |
setMaxRecordLength(int length) |
public static final int DICT_SIZE
public static final int DICT_MASK
protected LZWDecompresser(boolean maskMeansCompressed, int codeLengthIncrease, boolean positionIsBigEndian)
public static void setMaxRecordLength(int length)
length
- the max record length allowed for LZWDecompresserpublic static int getMaxRecordLength()
protected abstract int populateDictionary(byte[] dict)
protected abstract int adjustDictionaryOffset(int offset)
public byte[] decompress(java.io.InputStream src) throws java.io.IOException
java.io.IOException
public void decompress(java.io.InputStream src, java.io.OutputStream res) throws java.io.IOException
java.io.IOException
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.