writeBufferPart method

Future<Buffer> writeBufferPart(
  1. Buffer buffer,
  2. int start,
  3. int length
)

Implementation

Future<Buffer> writeBufferPart(Buffer buffer, int start, int length) {
  log.fine('writeBuffer length=${buffer.length}');
  if (_closed) {
    throw StateError('Cannot write to socket, it is closed');
  }
  if (_writingBuffer != null) {
    throw StateError('Cannot write to socket, already writing');
  }
  _writingBuffer = buffer;
  _writeCompleter = Completer<Buffer>();
  _writeOffset = start;
  _writeLength = length + start;

  _writeBuffer();

  return _writeCompleter.future;
}