CharMapStringEncoder class

Encodes Strings based on the charMap that this is initialized with.

If the string that is attempted to be encoded contains values that don't exist in the charMap the function will fail.

Implemented types

Constructors

CharMapStringEncoder({required Map<String, int> charMap, String mapInvalidCharacter(String) = _defaultMapInvalidCharacter})
Assumes that charMap will never change. Value map must have at most 2^8 entries. In addition, 0 is a reserved value that can't be used.

Properties

bitsUsed int
latefinal
charMap Map<String, int>
final
chunksPerInt int
latefinal
hashCode int
The hash code for this object.
no setterinherited
mapInvalidCharacter String Function(String)
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(String source) String
override
decodeInt(int value) String
Decodes the given int back to the original value that was passed to []
encode(String source, {bool sanitized = true}) String
if sanitized is true, will run the sanitizedForEncoding function before encoding the string.
override
encodeStringChunk(String stringChunk) int
Encodes the stringChunk into the bits of an int.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sanitzeForEncoding(String source) String
Sanitizes the source by removing/replacing any values that can't show up.
override
toString() String
A string representation of this object.
inherited

Operators

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