readByteSync method

  1. @override
int readByteSync()
override

Synchronously reads a single byte from the file.

If end-of-file has been reached -1 is returned.

Throws a FileSystemException if the operation fails.

Implementation

@override
int readByteSync() {
  _assertIsOpen();
  _assertIsReadable('readByteSync');

  if (_position >= lengthSync()) {
    throw FileSystemException('Cannot readByte at end of file', path);
  }

  return _file.bytes[_position++];
}