Class LZWCodec.AbstractLZWDictionary

java.lang.Object
com.helger.base.codec.impl.LZWCodec.AbstractLZWDictionary
Direct Known Subclasses:
LZWCodec.LZWDecodeDictionary, LZWCodec.LZWEncodeDictionary
Enclosing class:
LZWCodec

protected abstract static class LZWCodec.AbstractLZWDictionary extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Special code to clear the table
    static final int
    Special code for end of file
    protected byte[][]
     
    protected int
     
    protected int
     
    static final int
    Maximum index
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    addEntry(byte @NonNull [] aByteSeq, boolean bForEncode)
    Add a new byte sequence entry to the dictionary.
    final int
     
    void
    Reset this dictionary to its initial state, clearing all entries and re-initializing with the 256 single-byte entries.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_CODE

      public static final int MAX_CODE
      Maximum index
      See Also:
    • CODE_CLEARTABLE

      public static final int CODE_CLEARTABLE
      Special code to clear the table
      See Also:
    • CODE_EOF

      public static final int CODE_EOF
      Special code for end of file
      See Also:
    • m_aTab

      protected byte[][] m_aTab
    • m_nFreeCode

      protected int m_nFreeCode
    • m_nCodeBits

      protected int m_nCodeBits
  • Constructor Details

    • AbstractLZWDictionary

      protected AbstractLZWDictionary()
  • Method Details

    • reset

      public void reset()
      Reset this dictionary to its initial state, clearing all entries and re-initializing with the 256 single-byte entries.
    • addEntry

      public final void addEntry(byte @NonNull [] aByteSeq, boolean bForEncode)
      Add a new byte sequence entry to the dictionary.
      Parameters:
      aByteSeq - The byte sequence to add. May not be null.
      bForEncode - true if this is used for encoding, false for decoding. This affects code length thresholds.
      Throws:
      EncodeException - if the table overflows during encoding.
      DecodeException - if the table overflows during decoding.
    • getNextFreeCode

      @Nonnegative public final int getNextFreeCode()
      Returns:
      The next free code in the dictionary. Always ≥ 0.