From: Rob Pike Date: Thu, 12 Mar 2020 00:25:39 +0000 (+1100) Subject: io: add a comment about how to turn a Reader into ByteReader X-Git-Tag: go1.15beta1~885 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=65bd07611c95d66c60eca57932714e6bd0059c54;p=gostls13.git io: add a comment about how to turn a Reader into ByteReader Offered as an alternative to CL 221380, which was more tutorial than necessary. Update #37344 Change-Id: Ide673b0b97983c2c2319a9311dc3d0a10567e6c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/223097 Reviewed-by: Ian Lance Taylor --- diff --git a/src/io/io.go b/src/io/io.go index 9cc3086c19..3dea70b947 100644 --- a/src/io/io.go +++ b/src/io/io.go @@ -236,6 +236,10 @@ type WriterAt interface { // ReadByte reads and returns the next byte from the input or // any error encountered. If ReadByte returns an error, no input // byte was consumed, and the returned byte value is undefined. +// +// ReadByte provides an efficient interface for byte-at-time +// processing. A Reader that does not implement ByteReader +// can be wrapped using bufio.NewReader to add this method. type ByteReader interface { ReadByte() (byte, error) }