aboutsummaryrefslogtreecommitdiff
path: root/src/io
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2020-03-12 11:25:39 +1100
committerRob Pike <r@golang.org>2020-03-12 01:31:41 +0000
commit65bd07611c95d66c60eca57932714e6bd0059c54 (patch)
treee943a5f274861340896db5ef0bfdce2e34fa6539 /src/io
parent67d93cfd35417eb97e967c992e5e567207936222 (diff)
downloadgo-65bd07611c95d66c60eca57932714e6bd0059c54.tar.gz
go-65bd07611c95d66c60eca57932714e6bd0059c54.zip
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 <iant@golang.org>
Diffstat (limited to 'src/io')
-rw-r--r--src/io/io.go4
1 files changed, 4 insertions, 0 deletions
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)
}