checkBytesAvailable method
Checks if number bytes are available in the stream.
Throws an error if not enough bytes are available.
Implementation
void checkBytesAvailable(int number) {
if (number > unreadLength) {
throw "There is not enough $number bytes in stream";
}
}