menu
  1. Dart
  2. dart:convert
  3. Latin1Decoder class
Latin1Decoder

Latin1Decoder class final

This class converts Latin-1 bytes (lists of unsigned 8-bit integers) to a string.

Example:

final latin1Decoder = latin1.decoder;
const encodedBytes = [224, 225, 226, 227, 228, 229];
final decoded = latin1Decoder.convert(encodedBytes);
print(decoded); // àáâãäå
// Hexadecimal values as source
const hexBytes = [0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5];
final decodedHexBytes = latin1Decoder.convert(hexBytes);
print(decodedHexBytes); // àáâãäå

Throws a FormatException if the encoded input contains values that are not in the range 0 .. 255 and allowInvalid is false ( the default ).

If allowInvalid is true, invalid bytes are converted to Unicode Replacement character U+FFFD (�).

Example with allowInvalid set to true:

const latin1Decoder = Latin1Decoder(allowInvalid: true);
const encodedBytes = [300];
final decoded = latin1Decoder.convert(encodedBytes);
print(decoded); // �
Inheritance

Constructors

Latin1Decoder.new ({bool allowInvalid = false})
Instantiates a new Latin1Decoder.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bind (Stream <List <int >> stream) Stream <String >
Transforms the provided stream.
inherited
cast <RS, RT>() Converter <RS, RT>
Provides a Converter<RS, RT> view of this stream transformer.
inherited
convert (List <int > bytes, [int start = 0, int? end]) String
Converts the bytes (a list of unsigned 7- or 8-bit integers) to the corresponding string.
inherited
fuse <TT>(Converter <String , TT> other) Converter <List <int >, TT>
Fuses this with other.
inherited
noSuchMethod (Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startChunkedConversion (Sink <String > sink) ByteConversionSink
Starts a chunked conversion.
toString () String
A string representation of this object.
inherited

Operators

operator == (Object other) bool
The equality operator.
inherited
dart:convert library

AltStyle によって変換されたページ (->オリジナル) /