restic/backend/s3/cont_reader.go

17 lines
318 B
Go
Raw Normal View History

2016-01-02 14:09:33 +01:00
package s3
2016-01-02 14:12:51 +01:00
import "io"
2016-01-02 14:09:33 +01:00
// ContinuousReader implements an io.Reader on top of an io.ReaderAt, advancing
// an offset.
type ContinuousReader struct {
R io.ReaderAt
Offset int64
}
func (c *ContinuousReader) Read(p []byte) (int, error) {
n, err := c.R.ReadAt(p, c.Offset)
c.Offset += int64(n)
return n, err
}