Class NufxLzw1InputStream

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

public class NufxLzw1InputStream extends InputStream
The NufxLzw1InputStream reads a data fork or resource fork written in the NuFX LZW/1 format.

The layout of the LZW/1 data is as follows:

"Fork" Header
+0 Word CRC-16 of the uncompressed data within the thread
+2 Byte Low-level volume number use to format 5.25" disks
+3 Byte RLE character used to decode this thread
Each subsequent 4K chunk of data
+0 Word Length after RLE compression (if RLE is not used, length will be 4096
+2 Byte A $01 indicates LZW applied to this chunk; $00 that LZW was not applied to this chunk

Note that the LZW string table is cleared after every chunk.

  • Constructor Details

  • Method Details

    • read

      public int read() throws IOException
      Read the next byte in the decompressed data stream.
      Specified by:
      read in class InputStream
      Throws:
      IOException
    • isCrcValid

      public boolean isCrcValid()
      Indicates if the computed CRC matches the CRC given in the data stream.
    • getGivenCrc

      public int getGivenCrc()
    • setGivenCrc

      public void setGivenCrc(int givenCrc)
    • getVolumeNumber

      public int getVolumeNumber()
    • setVolumeNumber

      public void setVolumeNumber(int volumeNumber)
    • getRleCharacter

      public int getRleCharacter()
    • setRleCharacter

      public void setRleCharacter(int rleCharacter)
    • getDataCrc

      public long getDataCrc()