readLong method

Future<int> readLong()

Reads and returns an 8-byte integer decoded with the current endian setting.

Throws EOFException if EOF is reached before the needed bytes are read.

Implementation

Future<int> readLong() async {
  await _ensureNext();
  if (_curr!.length - _pos < 8) {
    // If we're on a buffer boundary
    // Keep it simple
    return (await readByteDataImmutable(8)).getInt64(0, endian);
  } else {
    final result = _curr!.buffer
        .asByteData()
        .getInt64(_pos + _curr!.offsetInBytes, endian);
    _pos += 8;
    return result;
  }
}