checkEmpty method
void
checkEmpty()
Checks if the stream is empty (all bytes have been read).
Throws an error if there are unread bytes.
Implementation
void checkEmpty() {
if (unreadLength != 0) {
throw "Stream has $unreadLength bytes after decode";
}
}