Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Decoder.Buffered to return buffered data #412

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

fxamacker
Copy link
Owner

Buffered returns an io.Reader for data remaining in Decoder's buffer. The returned reader is valid until the next call to Decode or Skip.

This basically matches Decoder.Buffered in Go's encoding/json.

Thanks @immesys for discussions and insights at PR #397.

Buffered returns an io.Reader for data remaining in Decoder's buffer.
The returned reader is valid until the next call to Decode or Skip.

This basically matches the Decoder.Buffered() in Go's encoding/json.
@fxamacker fxamacker added the enhancement New feature or request label Jun 25, 2023
stream.go Show resolved Hide resolved
@immesys
Copy link
Contributor

immesys commented Jun 25, 2023

This is great, thank you for adding this! I think I'll close #397 for now and change our code to use Decoder.Buffered. If this comes up again in our profiling, I'll do the testing of "don't read ahead if the input reader supports efficient byte-at-a-time reading" and open a new PR if warranted.

Thanks again for your work on maintaining this library!

Copy link
Contributor

@immesys immesys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@fxamacker fxamacker merged commit 56509bf into master Jun 26, 2023
@fxamacker fxamacker deleted the fxamacker/add-decoder-buffered branch December 28, 2023 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants