All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ReadableByteChannel

final class PackBits extends CompressionChannel
Inflater for values encoded with the "PackBits" compression. This compression is described in section 9 of TIFF 6 specification.
Since:
1.1
Version:
1.3
  • Field Details

    • literalCount

      private int literalCount
      Number of bytes to copy literally from the input. Only one of literalCount and duplicatedCount can be non-zero.
    • duplicatedCount

      private int duplicatedCount
      Number of times to copy the duplicated byte. Only one of literalCount and duplicatedCount can be non-zero.
    • duplicated

      private byte duplicated
      Byte to copy many times. The number of copies is given by duplicatedCount.
  • Constructor Details

    • PackBits

      public PackBits(ChannelDataInput input, StoreListeners listeners)
      Creates a new channel which will decompress data from the given input. The setInputRegion(long, long) method must be invoked after construction before a reading process can start.
      Parameters:
      input - the source of data to decompress.
      listeners - object where to report warnings.
  • Method Details

    • setInputRegion

      public void setInputRegion(long start, long byteCount) throws IOException
      Prepares this inflater for reading a new tile or a new band of a tile.
      Overrides:
      setInputRegion in class CompressionChannel
      Parameters:
      start - stream position where to start reading.
      byteCount - number of bytes to read from the input.
      Throws:
      IOException - if the stream cannot be seek to the given start position.
    • read

      public int read(ByteBuffer target) throws IOException
      Decompresses some bytes from the input into the given destination buffer.
      Parameters:
      target - the buffer into which bytes are to be transferred.
      Returns:
      the number of bytes read, or -1 if end-of-stream.
      Throws:
      IOException - if some other I/O error occurs.