Class LzwInputStream

java.lang.Object
java.io.InputStream
com.webcodepro.shrinkit.io.LzwInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public class LzwInputStream extends InputStream
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 Details

    • LzwInputStream

      public LzwInputStream(BitInputStream is)
      Create the LzwInputStream based on the given BitInputStream.
      See Also:
  • Method Details

    • read

      public int read() throws IOException
      Answer with the next byte from the (now) decompressed input stream.
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • fillBuffer

      public void fillBuffer() throws IOException
      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 to fillBuffer.
    • 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.