Documentation ¶
Overview ¶
Package secio provides support for sectioned I/O.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrReachedLimit = errors.New("reached limit")
ErrReachedLimit is returned when SectionReader.Read or SectionWriter.Write reaches its limit.
Functions ¶
This section is empty.
Types ¶
type FullReader ¶
FullReader adapts an io.Reader to never return partial reads with a nil error.
type SectionReader ¶
type SectionReader struct {
// contains filtered or unexported fields
}
SectionReader implements io.Reader on a section of an underlying io.ReaderAt. It is similar to io.SectionReader, but:
Reading beyond the limit returns ErrReachedLimit, not io.EOF.
Limit overflow is handled correctly.
func NewOffsetReader ¶
func NewOffsetReader(r io.ReaderAt, off int64) *SectionReader
NewOffsetReader returns an io.Reader that reads from r starting at offset off.
func NewSectionReader ¶
func NewSectionReader(r io.ReaderAt, off int64, n int64) *SectionReader
NewSectionReader returns an io.Reader that reads from r starting at offset off and stops with ErrReachedLimit after n bytes.
type SectionWriter ¶
type SectionWriter struct {
// contains filtered or unexported fields
}
SectionWriter implements io.Writer on a section of an underlying io.WriterAt. Writing beyond the limit returns ErrReachedLimit.
func NewOffsetWriter ¶
func NewOffsetWriter(w io.WriterAt, off int64) *SectionWriter
NewOffsetWriter returns an io.Writer that writes to w starting at offset off.
func NewSectionWriter ¶
func NewSectionWriter(w io.WriterAt, off int64, n int64) *SectionWriter
NewSectionWriter returns an io.Writer that writes to w starting at offset off and stops with ErrReachedLimit after n bytes.