read method

int read(
  1. Uint8List buffer,
  2. int offset,
  3. int count
)

Implementation

int read(Uint8List buffer, int offset, int count) {
  int bytesToRead = count;
  if (_position + count > _data.length) {
    bytesToRead = _data.length - _position;
  }
  if (bytesToRead <= 0) return 0;
  buffer.setRange(
    offset,
    offset + bytesToRead,
    _data.sublist(_position, _position + bytesToRead),
  );
  _position += bytesToRead;
  return bytesToRead;
}