writeInputStream method

  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 {
    final bytes = stream.toUint8List();
    for (int i = 0, j = length, l = bytes.length; i < l; ++i, ++j) {
      _buffer[j] = bytes[i];
    }
  }
  length += stream.length;
}