Package com.webcodepro.shrinkit.io
Class LzwInputStream
java.lang.Object
java.io.InputStream
com.webcodepro.shrinkit.io.LzwInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This is the generic Shrinkit LZW decompression algorithm.
It does not deal with the vagaries of the LZW/1 and LZW/2 data streams.
It does, however, deal with dictionary clears (0x100) and the
BitInputStream bit sizes.-
Constructor Summary
ConstructorsConstructorDescriptionCreate theLzwInputStreambased on the givenBitInputStream. -
Method Summary
Modifier and TypeMethodDescriptionvoidProvide necessary housekeeping to reset LZW stream between NuFX buffer changes.voidClear out the dictionary.voidFill the buffer up with some decompressed data.intread()Answer with the next byte from the (now) decompressed input stream.Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
LzwInputStream
Create theLzwInputStreambased on the givenBitInputStream.- See Also:
-
-
Method Details
-
read
Answer with the next byte from the (now) decompressed input stream.- Specified by:
readin classInputStream- Throws:
IOException
-
fillBuffer
Fill the buffer up with some decompressed data. This may range from one byte to many bytes, depending on what is in the dictionary.- Throws:
IOException- See Also:
-
clearDictionary
public void clearDictionary()Clear out the dictionary. It will be rebuilt on the next call tofillBuffer. -
clearData
public void clearData()Provide necessary housekeeping to reset LZW stream between NuFX buffer changes. The dictionary is the only item that is not cleared -- that needs to be done explicitly since behavior between LZW/1 and LZW/2 differ.
-