MqttUtf8Encoding class

Encoding implementation that can encode and decode strings in the MQTT UTF8 string format.

Text fields within the MQTT Control Packets are encoded as UTF-8 strings. UTF-8 RFC3629 is an efficient encoding of Unicode Unicode characters that optimizes the encoding of ASCII characters in support of text-based communications.

Each of these strings is prefixed with a two byte integer length field that gives the number of bytes in a UTF-8 encoded string itself. Consequently, the maximum size of a UTF-8 encoded string is 65,535 bytes.

Inheritance

Constructors

MqttUtf8Encoding()

Properties

decoder Utf8Decoder
Returns the decoder of this, converting from List<int> to String.
no setterinherited
encoder Utf8Encoder
Returns the encoder from String to List<int>.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
inverted Codec<List<int>, String>
Inverts this.
no setterinherited
name String
The name of this codec is "utf-8".
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

byteCount(String chars) int
Gets the total length of a UTF8 encoded string including the length bytes
decode(List<int> codeUnits, {bool? allowMalformed}) String
Decodes the UTF-8 codeUnits (a list of unsigned 8-bit integers) to the corresponding string.
inherited
decodeStream(Stream<List<int>> byteStream) Future<String>
inherited
encode(String string) Uint8List
Encodes the string as UTF-8.
inherited
fromUtf8(Uint8Buffer bytes) String
Decodes the bytes in the specified MQTT UTF8 encoded byte array into a string.
fuse<R>(Codec<List<int>, R> other) Codec<String, R>
Fuses this with other.
inherited
length(Uint8Buffer bytes) int
Gets the length of a UTF8 encoded string from the length bytes
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toUtf8(String s) → Uint8Buffer
Encodes all the characters in the specified string into a sequence of bytes.

Operators

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