Package readerutil provides and operates on io.Readers.
Package readerutil contains io.Reader types.
NewBufferingReaderAt returns an io.ReaderAt that reads from r as necessary and keeps a copy of all data read in memory.
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.
NewStatsReadSeeker returns an io.ReadSeeker that will have the number of bytes read from rs added to v.
NewStatsReader returns an io.Reader that will have the number of bytes read from r added to v.
var ( // r is the io.Reader we'd like to count read from. r = strings.NewReader("Hello world") v = expvar.NewInt("read-bytes") sw = NewStatsReader(v, r) ) // Read from the wrapped io.Reader, StatReader will count the bytes. io.Copy(ioutil.Discard, sw) fmt.Printf("Read %s bytes\n", v.String())
Read 11 bytes
Size tries to determine the length of r. If r is an io.Seeker, Size may seek to guess the length.
CountingReader wraps a Reader, incrementing N by the number of bytes read. No locking is performed.
A ReadSeekCloser can Read, Seek, and Close.
A SizeReaderAt is a ReaderAt with a Size method.
An io.SectionReader implements SizeReaderAt.
NewMultiReaderAt is like io.MultiReader but produces a ReaderAt (and Size), instead of just a reader.
|singlereader||package singlereader provides Open and Close operations, reusing existing file descriptors when possible.|