bytes, string: add Reset method to Reader
Currently, there is no easy allocation-free way to turn a []byte or string into an io.Reader. Thus, we add a Reset method to bytes.Reader and strings.Reader to allow the reuse of these Readers with another []byte or string. This is consistent with the fact that many standard library io.Readers already support a Reset method of some type: bufio.Reader flate.Reader gzip.Reader zlib.Reader debug/dwarf.LineReader bytes.Buffer crypto/rc4.Cipher Fixes #15033 Change-Id: I456fd1af77af6ef0b4ac6228b058ac1458ff3d19 Reviewed-on: https://go-review.googlesource.com/21386Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Showing
Please register or sign in to comment