readInt method
Reads and returns a 4-byte signed integer decoded with the current endian setting.
Throws EOFException if EOF is reached before the needed bytes are read.
Implementation
Future<int> readInt() async {
await _ensureNext();
if (_curr!.length - _pos < 4) {
// If we're on a buffer boundary, keep it simple
return (await readByteDataImmutable(4)).getInt32(0, endian);
} else {
final result = _curr!.buffer
.asByteData()
.getInt32(_pos + _curr!.offsetInBytes, endian);
_pos += 4;
return result;
}
}