readFromFile method

  1. @override
Future<Readbuffer> readFromFile(
  1. int length
)
override

Reads the given amount of bytes from the file into the read buffer and resets the internal buffer position. If the capacity of the read buffer is too small, a larger one is created automatically.

@param length the amount of bytes to read from the file. @return true if the whole data was read successfully, false otherwise. @throws IOException if an error occurs while reading the file.

Implementation

@override
Future<Readbuffer> readFromFile(int length) {
  Uint8List cont = content.sublist(_lastOffset, _lastOffset + length);
  assert(cont.length == length);
  Readbuffer result = Readbuffer(cont, _lastOffset);
  _lastOffset += length;
  return Future.value(result);
}