W3cubDocs

/Dart 2

startChunkedConversion method

ByteConversionSink startChunkedConversion (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 = new 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 new _ErrorHandlingAsciiDecoderSink(stringSink.asUtf8Sink(false));
  } else {
    return new _SimpleAsciiDecoderSink(stringSink);
  }
}

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