startChunkedConversion method

ByteConversionSink startChunkedConversion (
  1. Sink<String> sink
)

Starts a chunked conversion.

The converter works more efficiently if the given sink is a StringConversionSink.

Implementation

ByteConversionSink startChunkedConversion(Sink<String> sink) {
  StringConversionSink stringSink;
  if (sink is StringConversionSink) {
    stringSink = sink;
  } else {
    stringSink = StringConversionSink.from(sink);
  }
  // TODO(lrn): Use asUtf16Sink when it becomes available. It
  // works just as well, is likely to have less decoding overhead,
  // and make adding U+FFFD easier.
  // At that time, merge this with _Latin1DecoderSink;
  if (_allowInvalid) {
    return _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false));
  } else {
    return _SimpleAsciiDecoderSink(stringSink);
  }
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-convert/AsciiDecoder/startChunkedConversion.html