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 ReadByte method, satisfies the io.ByteReader interface #51

Merged
merged 1 commit into from Jun 8, 2021

Conversation

buth
Copy link
Contributor

@buth buth commented Feb 17, 2020

Hey all.

In this PR I've added a ReadByte method to Reader in order to implement the io.ByteReader interface. The reasoning is that snappy's reader is already buffered, and needing to wrap it with a bufio.Reader instance in order to, say, directly decode varints leads to extra copying and complication.

I've tried to add as little code as possible, and the only notable change to the code of Reader was to move the buffer-filling loop from the Read method to a bufio-style fill method. The test is a modified version of the test for a buffered Writer, but covers the use case of encoding the length of entries as varints.

Thanks!

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@buth
Copy link
Contributor Author

buth commented Feb 17, 2020

I did not realize this was a project "owned or managed by Google" (as it's under golang, not google). I'll need to consider the terms of CLA and get back to you.

@buth
Copy link
Contributor Author

buth commented Feb 17, 2020

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@nigeltao nigeltao merged commit 3ff355f into golang:master Jun 8, 2021
@pracucci pracucci mentioned this pull request Aug 16, 2021
3 tasks
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.

None yet

3 participants