ByteConversionSink startChunkedConversion(Sink<String> sink)

Starts a chunked conversion.

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

Source

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);
  }
}