mirror of
https://github.com/golang/go
synced 2024-10-05 21:21:21 -06:00
c264c87335
As noted on recently on golang-nuts, there's currently no way to know the total size of a strings.Reader or bytes.Reader when using ReadAt on them. Most callers resort to wrapping it in an io.SectionReader to retain that information. The SizeReaderAt abstraction (an io.ReaderAt with a Size() int64 method) has proven useful as a way of expressing a concurrency-safe read-only number of bytes. As one example, see http://talks.golang.org/2013/oscon-dl.slide#49 and the rest of that presentation for its use in dl.google.com. SizeReaderAt is also used in the open source google-api-go-client, and within Google's internal codebase, where it exists in a public package created in 2013 with the package comment: "These may migrate to the standard library after we have enough experience with their feel." I'm still as happy with the SizeReaderAt abstraction and its composabilty as I was in 2013, so I'd like to make these two Readers also be SizeReaderAts. Fixes #9667 Change-Id: Ie6f145ada419dd116280472d8c029f046d5edf70 Reviewed-on: https://go-review.googlesource.com/3199 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Reviewed-by: Rob Pike <r@golang.org> |
||
---|---|---|
.. | ||
compare_test.go | ||
compare.go | ||
example_test.go | ||
export_test.go | ||
reader_test.go | ||
reader.go | ||
replace_test.go | ||
replace.go | ||
search_test.go | ||
search.go | ||
strings_decl.go | ||
strings_test.go | ||
strings.go | ||
strings.s |