5 // OffsetReaderAt transforms an io.ReaderAt into an io.Reader by beginning and
6 // advancing all reads at the given offset.
7 type OffsetReaderAt struct {
8 // r is the data source for this instance of *OffsetReaderAt.
11 // o if the number of bytes read from the underlying data source, "r".
12 // It is incremented upon reads.
16 // Read implements io.Reader.Read by reading into the given []byte, "p" from the
17 // last known offset provided to the OffsetReaderAt.
19 // It returns any error encountered from the underlying data stream, and
20 // advances the reader forward by "n", the number of bytes read from the
21 // underlying data stream.
22 func (r *OffsetReaderAt) Read(p []byte) (n int, err error) {
23 n, err = r.r.ReadAt(p, r.o)