Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new PbfStreamReader class that enables stream-based reading of Protocol Buffers binary data, complementing the existing block-based PbfBlockReader. The implementation extracts shared encoding/decoding logic into a new PbfEncoding helper class to avoid code duplication.
Key Changes
- Introduces
PbfStreamReaderwith support for reading Protocol Buffers from streams instead of memory blocks - Refactors common zigzag decoding and field header encoding/decoding logic into a shared
PbfEncodingclass - Provides comprehensive test coverage including unit tests, system type tests, collection tests, and round-trip tests
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PbfLite/PbfStreamReader.cs | Core stream reader implementation with varint reading, fixed-size reading, and field skipping logic |
| src/PbfLite/PbfStreamReader.SystemTypes.cs | Methods for reading system types (strings, booleans, integers, floats, doubles) from streams |
| src/PbfLite/PbfStreamReader.Collections.cs | Collection reading support for all supported scalar types |
| src/PbfLite/PbfEncoding.cs | Extracted shared encoding/decoding helper methods used by both block and stream readers |
| src/PbfLite/PbfBlockReader.cs | Refactored to remove zigzag methods (moved to PbfEncoding) |
| src/PbfLite/PbfBlockReader.SystemTypes.cs | Updated to use PbfEncoding.Zag for zigzag decoding |
| src/PbfLite/PbfBlockReader.Collections.cs | Refactored to use PbfEncoding.EstimateItemsCount for capacity estimation |
| src/PbfLite.Tests/PbfStreamReaderTests.cs | Unit tests for stream reader core functionality |
| src/PbfLite.Tests/PbfStreamReaderTests.SystemTypes.cs | Tests for system type reading methods |
| src/PbfLite.Tests/PbfStreamReaderTests.Primitives.cs | Tests for primitive varint and fixed-size reading |
| src/PbfLite.Tests/PbfStreamReaderTests.Collections.cs | Tests for collection reading functionality |
| src/PbfLite.Tests/PbfBlockReaderTests.cs | Updated tests to use PbfEncoding.Zag |
| src/PbfLite.Tests/PbfBlockReaderStreamReaderRoundTripTests.cs | Round-trip tests verifying compatibility between block writer and stream reader |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 22 out of 22 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
No description provided.