Package com.helger.base.codec.impl
Class LZWCodec.AbstractLZWDictionary
java.lang.Object
com.helger.base.codec.impl.LZWCodec.AbstractLZWDictionary
- Direct Known Subclasses:
LZWCodec.LZWDecodeDictionary,LZWCodec.LZWEncodeDictionary
- Enclosing class:
LZWCodec
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSpecial code to clear the tablestatic final intSpecial code for end of fileprotected byte[][]protected intprotected intstatic final intMaximum index -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
MAX_CODE
public static final int MAX_CODEMaximum index- See Also:
-
CODE_CLEARTABLE
public static final int CODE_CLEARTABLESpecial code to clear the table- See Also:
-
CODE_EOF
public static final int CODE_EOFSpecial 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 benull.bForEncode-trueif this is used for encoding,falsefor 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.
-