readUint64 method

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

Read a 64-bit unsigned int at the given position within the file.

Implementation

int readUint64(int position, [int? fileSize]) {
  if (position >= (_fileSize - 8) || position < 0) {
    return 0;
  }
  if (position < _position || position >= (_position + (_bufferSize - 8))) {
    _readBuffer(position, fileSize ?? _fileSize);
  }
  var p = position - _position;
  final b1 = _buffer![p++];
  final b2 = _buffer![p++];
  final b3 = _buffer![p++];
  final b4 = _buffer![p++];
  final b5 = _buffer![p++];
  final b6 = _buffer![p++];
  final b7 = _buffer![p++];
  final b8 = _buffer![p++];

  if (byteOrder == ByteOrder.bigEndian) {
    return (b1 << 56) |
        (b2 << 48) |
        (b3 << 40) |
        (b4 << 32) |
        (b5 << 24) |
        (b6 << 16) |
        (b7 << 8) |
        b8;
  }
  return (b8 << 56) |
      (b7 << 48) |
      (b6 << 40) |
      (b5 << 32) |
      (b4 << 24) |
      (b3 << 16) |
      (b2 << 8) |
      b1;
}