• Joe Tsai's avatar
    bytes, string: add Reset method to Reader · e88f8902
    Joe Tsai authored
    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: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    e88f8902
Name
Last commit
Last update
..
compare.go Loading commit data...
compare_test.go Loading commit data...
example_test.go Loading commit data...
export_test.go Loading commit data...
reader.go Loading commit data...
reader_test.go Loading commit data...
replace.go Loading commit data...
replace_test.go Loading commit data...
search.go Loading commit data...
search_test.go Loading commit data...
strings.go Loading commit data...
strings.s Loading commit data...
strings_amd64.go Loading commit data...
strings_decl.go Loading commit data...
strings_generic.go Loading commit data...
strings_test.go Loading commit data...