Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewBufferingReaderAt ¶
NewBufferingReaderAt returns an io.ReaderAt that reads from r as necessary and keeps a copy of all data read in memory.
func NewFakeSeeker ¶
func NewFakeSeeker(r io.Reader, size int64) io.ReadSeeker
NewFakeSeeker returns a ReadSeeker that can pretend to Seek (based on the provided total size of the reader's content), but any reads will fail if the fake seek position doesn't match reality.
Types ¶
type CountingReader ¶
CountingReader wraps a Reader, incrementing N by the number of bytes read. No locking is performed.
func NewCountingReader ¶
func NewCountingReader(r io.Reader, n *int64) *CountingReader
NewCountingReader returns a CountingReader that wraps r and counts bytes in n.
Example ¶
var (
// r is the io.Reader we'd like to count read from.
r = strings.NewReader("Hello world")
n int64
cr = NewCountingReader(r, &n)
)
// Read from the wrapped io.Reader, CountingReader will count the bytes.
io.Copy(io.Discard, cr)
fmt.Printf("Read %d bytes\n", n)
Output: Read 11 bytes
type ReadSeekCloser ¶
ReadSeekCloser can Read, Seek, and Close.
type ReaderAtCloser ¶
ReaderAtCloser can ReadAt and Close.
type SizeReaderAt ¶
SizeReaderAt is a ReaderAt with a Size method. An io.SectionReader implements SizeReaderAt.
func NewMultiReaderAt ¶
func NewMultiReaderAt(parts ...SizeReaderAt) SizeReaderAt
NewMultiReaderAt is like io.MultiReader but produces a ReaderAt (and Size), instead of just a reader.