org.apache.commons.compress.compressors.z._internal_

## Class InternalLZWInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.commons.compress.compressors.CompressorInputStream
    - - org.apache.commons.compress.compressors.z._internal_.InternalLZWInputStream

- All Implemented Interfaces:
    Closeable
  Direct Known Subclasses:
    ZCompressorInputStream

      public abstract class InternalLZWInputStream
      extends CompressorInputStream

  This class is only public for technical reasons and is not part of Commons Compress' published API - it may change or disappear without warning.

  Base-class for traditional Unix ".Z" compression and the Unshrinking method of ZIP archive.

  Since:
    1.7

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `bitsCached`
    `protected int` | `bitsCachedSize`
    `protected byte[]` | `characters`
    `protected int` | `clearCode`
    `protected int` | `codeSize`
    `protected InputStream` | `in`
    `protected int[]` | `prefixes`
    `protected int` | `previousCode`
    `protected int` | `tableSize`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `InternalLZWInputStream(InputStream inputStream)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract int` | `addEntry(int previousCode, byte character)` Add a new entry to the dictionary.
    `protected int` | `addEntry(int previousCode, byte character, int maxTableSize)` Adds a new entry if the maximum table size hasn't been exceeded and returns the new index.
    `protected int` | `addRepeatOfPreviousCode()` Add entry for repeat of previousCode we haven't added, yet.
    `void` | `close()`
    `protected abstract int` | `decompressNextSymbol()` Read the next code and expand it.
    `protected int` | `expandCodeToOutputStack(int code, boolean addedUnfinishedEntry)` Expands the entry with index code to the output stack and may create a new entry
    `protected void` | `initializeTables(int maxCodeSize)` Initializes the arrays based on the maximum code size.
    `int` | `read()`
    `int` | `read(byte[] b, int off, int len)`
    `protected int` | `readNextCode()` Reads the next code from the stream.
    `protected void` | `setClearCode(int codeSize)` Sets the clear code based on the code size.

    - ### Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream

      `count, count, getBytesRead, getCount, pushedBackBytes`

    - ### Methods inherited from class java.io.InputStream

      `available, mark, markSupported, read, reset, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### in

          protected final InputStream in

    - #### clearCode

          protected int clearCode

    - #### codeSize

          protected int codeSize

    - #### bitsCached

          protected int bitsCached

    - #### bitsCachedSize

          protected int bitsCachedSize

    - #### previousCode

          protected int previousCode

    - #### tableSize

          protected int tableSize

    - #### prefixes

          protected int[] prefixes

    - #### characters

          protected byte[] characters

  - ### Constructor Detail

    - #### InternalLZWInputStream

          protected InternalLZWInputStream(InputStream inputStream)

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Overrides:
        `close` in class `InputStream`
      Throws:
        `IOException`

    - #### read

          public int read()
                   throws IOException

      Specified by:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### read

          public int read(byte[] b,
                 int off,
                 int len)
                   throws IOException

      Overrides:
        `read` in class `InputStream`
      Throws:
        `IOException`

    - #### decompressNextSymbol

          protected abstract int decompressNextSymbol()
                                               throws IOException

      Read the next code and expand it.
      Throws:
        `IOException`

    - #### addEntry

          protected abstract int addEntry(int previousCode,
                     byte character)
                                   throws IOException

      Add a new entry to the dictionary.
      Throws:
        `IOException`

    - #### setClearCode

          protected void setClearCode(int codeSize)

      Sets the clear code based on the code size.

    - #### initializeTables

          protected void initializeTables(int maxCodeSize)

      Initializes the arrays based on the maximum code size.

    - #### readNextCode

          protected int readNextCode()
                              throws IOException

      Reads the next code from the stream.
      Throws:
        `IOException`

    - #### addEntry

          protected int addEntry(int previousCode,
                     byte character,
                     int maxTableSize)

      Adds a new entry if the maximum table size hasn't been exceeded and returns the new index.

    - #### addRepeatOfPreviousCode

          protected int addRepeatOfPreviousCode()
                                         throws IOException

      Add entry for repeat of previousCode we haven't added, yet.
      Throws:
        `IOException`

    - #### expandCodeToOutputStack

          protected int expandCodeToOutputStack(int code,
                                    boolean addedUnfinishedEntry)
                                         throws IOException

      Expands the entry with index code to the output stack and may create a new entry
      Throws:
        `IOException`

Copyright © 2014 The Apache Software Foundation. All rights reserved.