Documentation ¶
Index ¶
- func Wrap(w DoerAt, p []byte, off int64, wrapAt int64) (n int, err error)
- type DoAtFunc
- type DoerAt
- type ReadWriterAt
- type WrapReader
- type WrapWriter
- type Wrapper
- func (wpr *Wrapper) Cap() int64
- func (wpr *Wrapper) Len() int64
- func (wpr *Wrapper) Read(p []byte) (n int, err error)
- func (wpr *Wrapper) ReadAt(p []byte, off int64) (n int, err error)
- func (wpr *Wrapper) Reset()
- func (wpr *Wrapper) SetReadWriterAt(rwa ReadWriterAt)
- func (wpr *Wrapper) Write(p []byte) (n int, err error)
- func (wpr *Wrapper) WriteAt(p []byte, off int64) (n int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ReadWriterAt ¶
ReadWriterAt implements io.ReaderAt and io.WriterAt
type WrapReader ¶
type WrapReader struct {
// contains filtered or unexported fields
}
WrapReader wraps reads around a section of data.
func NewWrapReader ¶
func NewWrapReader(r io.ReaderAt, off int64, wrapAt int64) *WrapReader
NewWrapReader creates a WrapReader starting at offset off, and wrapping at offset wrapAt.
func (*WrapReader) Read ¶
func (r *WrapReader) Read(p []byte) (n int, err error)
Read reads into p starting at the current offset, wrapping if it reaches the end. The current offset is shifted forward by the amount read.
type WrapWriter ¶
type WrapWriter struct {
// contains filtered or unexported fields
}
WrapWriter wraps writes around a section of data.
func NewWrapWriter ¶
func NewWrapWriter(w io.WriterAt, off int64, wrapAt int64) *WrapWriter
NewWrapWriter creates a WrapWriter starting at offset off, and wrapping at offset wrapAt.
type Wrapper ¶
type Wrapper struct { // N is the offset at which to "wrap" back to the start N int64 // L is the length of the data written L int64 // O is our offset in the data O int64 // contains filtered or unexported fields }
Wrapper implements a io.ReadWriter and ReadWriterAt such that when reading/writing goes past N bytes, it "wraps" back to the beginning.
func NewWrapper ¶
func NewWrapper(rwa ReadWriterAt, L, O, N int64) *Wrapper
NewWrapper creates a Wrapper based on ReadWriterAt rwa. L is the current length, O is the current offset, and N is offset at which we "wrap".
func (*Wrapper) Reset ¶
func (wpr *Wrapper) Reset()
Reset seeks to the start (0 offset), and sets the length to 0.
func (*Wrapper) SetReadWriterAt ¶
func (wpr *Wrapper) SetReadWriterAt(rwa ReadWriterAt)
SetReadWriterAt lets you switch the underlying Read/WriterAt