4.0.0#9
Merged
Merged
Conversation
- **BinaryReader**: removed `reset()` method — use `seek(0)` instead **New Features:** - **BinaryReader**: added `rebind(Uint8List)` — rebinds the reader to a new buffer without allocating a new instance (useful for streaming scenarios) **Fixes:** - **BinaryReader**: added bounds check to `peekByte()` — now throws `RangeError` consistently like other read methods **Tests:** - Added tests for `BinaryReader.rebind()` — normal rebind, partial reads, zero-length buffer, identity preservation, multiple rebinds, non-zero buffer offset
…ion to the specified byte offset (useful for backtracking and overwriting data mid-stream)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES:
reset()method — useseek(0)insteadNew Features:
rebind(Uint8List)— rebinds the reader to a new buffer without allocating a new instance (useful for streaming scenarios)seek(int position)— sets the write position to the specified byte offset (useful for backtracking and overwriting data mid-stream)writeUint8At(int position, int value)— writes a byte at the specified position without changing the current write positionwriteVarStringnow usesseekinternally for VarInt length rewritingStreamBinaryReader— chunk-based reader for asynchronous streaming data with bookmark/rollback/commit transactional modelBinaryStreamTransformer<T>— abstractStreamTransformerfor parsing binary messages from streams with automaticNotEnoughDataExceptionhandlingNotEnoughDataException— carriesrequired/availablebyte counts for debugging incomplete data scenariosFixes:
peekByte()— now throwsRangeErrorconsistently like other read methodsTests: Improved all tests