LZW class

A Codec which can en- and decode messages.

Constructors

LZW({List alphabet, int codeSize, bool debugDecoding: false, bool debugEncoding: false})
Instantiates a new LZW object. [...]

Properties

alphabet List
the input characters come from this alphabet. An exception is thrown if an invaid character is found during encoding.
final
blank int
blank byte. Is written if the codebook is full and marks the reset moment.
read-only
coder LZW
LZW instance used for decoding as an encoding step will be performed parallel.
read / write
codeSize int
represents how big the total codebook is, including alphabet and blank character
final
debugDecoding bool
Should debug-messages during decoding be printed into console?
final
debugEncoding bool
Should debug-messages during encoding be printed into console?
final
hashCode int
The hash code for this object. [...]
read-only, inherited
praefix String
Current praefix. Contains the longest pattern found in the codebook during encoding.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
temporaryDecodeResult String
Contains the current decoding result. It only contains characters defined in alphabet.
read-only

Methods

addInput(String input) LZW
feeds a String into the encoder. This can be done as many times as needed. To finalize, the method finalizeEncoding() has to be called.
decode(List<int> lzw) LZW
feeds a list of numbers into the decoder. This can be done as many times as needed. To finalize, the method finalizeDecoding() has to be called.
finalizeDecoding() String
Returns the decoded String and resets the algorithm.
finalizeEncoding() List<int>
Treats the remaining _praefix if existing and returns the encoded numbers and resets the algorithm.
getCodeWord(String pattern) int
get the codeWord for a String. The value will be < alphabet.length if the String is found in the alphabet, > alphabet.length otherwise. If the given String does not exist in the codebook, null will be returned.
getInverseCodeWord(dynamic value) String
get the String to a codeword. Used for decoding.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
reset() → void
resets the algorithm. Clears the output String, empties the codebook and clears _praefix and _symbol
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited