Skip to content

4.0.0#9

Merged
pro100andrey merged 17 commits into
mainfrom
improvements
May 26, 2026
Merged

4.0.0#9
pro100andrey merged 17 commits into
mainfrom
improvements

Conversation

@pro100andrey
Copy link
Copy Markdown
Owner

BREAKING CHANGES:

  • 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)
  • BinaryWriter: added seek(int position) — sets the write position to the specified byte offset (useful for backtracking and overwriting data mid-stream)
  • BinaryWriter: added writeUint8At(int position, int value) — writes a byte at the specified position without changing the current write position
  • BinaryWriter: writeVarString now uses seek internally for VarInt length rewriting
  • Stream API: added StreamBinaryReader — chunk-based reader for asynchronous streaming data with bookmark/rollback/commit transactional model
  • Stream API: added BinaryStreamTransformer<T> — abstract StreamTransformer for parsing binary messages from streams with automatic NotEnoughDataException handling
  • Stream API: added NotEnoughDataException — carries required/available byte counts for debugging incomplete data scenarios

Fixes:

  • BinaryReader: added bounds check to peekByte() — now throws RangeError consistently like other read methods

Tests: Improved all tests

- **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)
@pro100andrey pro100andrey merged commit b6eca37 into main May 26, 2026
6 checks passed
@pro100andrey pro100andrey deleted the improvements branch May 26, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant