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 = StringConversionSink.from(sink);
  }
  // TODO(lrn): Use stringSink.asUtf16Sink() if it becomes available.
  if (!_allowInvalid) return _Latin1DecoderSink(stringSink);
  return _Latin1AllowInvalidDecoderSink(stringSink);
}