writeInputStream method Null safety

  1. @override
void writeInputStream(
  1. InputStreamBase stream
)
override

Write an InputStream to the output stream.

Implementation

@override
void writeInputStream(InputStreamBase stream) {
  while (length + stream.length > _buffer.length) {
    _expandBuffer((length + stream.length) - _buffer.length);
  }

  if (stream is InputStream) {
    _buffer.setRange(
        length, length + stream.length, stream.buffer, stream.offset);
  } else {
    var bytes = stream.toUint8List();
    _buffer.setRange(length, length + stream.length, bytes, 0);
  }
  length += stream.length;
}