2
2
mirror of https://github.com/octoleo/restic.git synced 2024-06-07 19:40:49 +00:00
restic/backend/s3/cont_reader.go

17 lines
318 B
Go
Raw Normal View History

2016-01-02 13:09:33 +00:00
package s3
2016-01-02 13:12:51 +00:00
import "io"
2016-01-02 13:09:33 +00: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
}