]> Cypherpunks repositories - gostls13.git/commitdiff
io: add a comment about how to turn a Reader into ByteReader
authorRob Pike <r@golang.org>
Thu, 12 Mar 2020 00:25:39 +0000 (11:25 +1100)
committerRob Pike <r@golang.org>
Thu, 12 Mar 2020 01:31:41 +0000 (01:31 +0000)
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 <iant@golang.org>
src/io/io.go

index 9cc3086c19bbd1d428b25013cd8d2a5d8caf2946..3dea70b947b71937a31058d2ea53159846259b6f 100644 (file)
@@ -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)
 }