startChunkedConversion 方法

ByteConversionSink startChunkedConversion(
  1. Sink<String> sink
)

开始块转换。

如果给定的 sink 是一个 StringConversionSink,则转换器运行得更有效率。

实现

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