`Io.Reader` buffer and `peek` paradox
Ziggit
`Io.Reader` buffer and `peek` paradox
I am probably overthinking something, but I’ve hit a bit of a quandary while trying to support peek for a base64 Io.Reader implementation. The issue is that peek expects stream to fill up to the full buffer for the Io.Reader. But the base64 decoding ratio is 4 to 3, which can result in needing to read more than one byte from the input reader to fill the next byte in the buffer. So on a peek that fills up the buffer with a partial chunk, the full chunk needs to stay in a buffer somewhere for the ...
0 comments
No comments yet.