readBytesImmutable method
Returns a potentially immutable Uint8List containing the desired number of bytes. If the returned list is mutable, changing it might write through our internal buffer.
Throws EOFException if EOF is reached before the needed bytes are read.
Implementation
Uint8List readBytesImmutable(int num) {
if (seek + num > _source.lengthInBytes) {
throw EOFException('Attempt to read beyond end of input');
} else {
final result = _source.sublist(seek, seek + num);
seek += num;
return result;
}
}