Closed buth closed 3 years ago
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).
:memo: 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.
ℹ️ Googlers: Go here for more info.
@googlebot I signed it!
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!