Objo.
Feedback Forum Docs Objo Studio
Feedback

Feature #1870

BinaryStream byte reads return partial chunks at EOF

Status
Fixed
Fixed in
v26.10.5
Area
compiler
Source discussion
https://forum.objo.dev/d/1405-binarystreamreadybytes-is-difficult-to-use-in-streams-because-it-throws
Last updated
2026-10-31

Upvotes

0 upvotes

Uses your Objo forum account.

Public summary

Make BinaryStream.ReadBytes(byteCount) and ReadBytesAsync(byteCount) return the bytes remaining when a read reaches the end of the file, instead of throwing because the final chunk is smaller than requested. Reading at EOF returns an empty MemoryBlock.

Add ReadBytesExactly(byteCount) and ReadBytesExactlyAsync(byteCount) for callers that require the complete requested number of bytes and want an IOException if the file ends early.

This makes buffered binary reads straightforward while giving binary-format parsers an explicit way to reject incomplete records. Update the API documentation with chunked-reading examples and guidance for migrating code that relies on the previous strict behaviour.

Objo.

Build apps visually, deploy anywhere.

Feedback is a public read-only status mirror for Objo Studio.