ACodec encodes and (if supported) decodes data.
Codecs can be fused. For example fusingjson andutf8 producesan encoder that can convert Json objects directly to bytes, or can decodebytes directly to json objects.
Fused codecs generally attempt to optimize the operations and can be fasterthan executing each step of an encoding separately.
TheCodec class provides a default implementation ofencode,decode,fuse andinverted.Subclasses can choose to provide more efficient implementations of these.
- Implementers
Constructors
- Codec()
- const
Properties
- decoder→Converter<
T,S> - Returns the decoder of
this, converting fromTtoS.no setter - encoder→Converter<
S,T> - Returns the encoder from
StoT.no setter - hashCode→int
- The hash code for this object.no setterinherited
- inverted→Codec<
T,S> - Inverts
this.no setter - runtimeType→Type
- A representation of the runtime type of the object.no setterinherited
Methods
- decode(
Tencoded)→ S - Decodes
encodeddata. - encode(
Sinput)→ T - Encodes
input. - fuse<
R> (Codec< T,R> other)→Codec<S,R> - Fuses
thiswithother. - noSuchMethod(
Invocationinvocation)→ dynamic - Invoked when a nonexistent method or property is accessed.inherited
- toString(
)→String - A string representation of this object.inherited
Operators
- operator ==(
Objectother)→bool - The equality operator.inherited