readUint8 method

int readUint8(
  1. int position, [
  2. int? fileSize
])

Read an 8-bit unsigned int at the given position within the file. fileSize is used to ensure bytes aren't read past the end of an InputFileStream.

Implementation

int readUint8(int position, [int? fileSize]) {
  if (position >= _fileSize || position < 0) {
    return 0;
  }
  if (position < _position || position >= (_position + _bufferSize)) {
    _readBuffer(position, fileSize ?? _fileSize);
  }
  final p = position - _position;
  return _buffer![p];
}