gvisorgvisor.dev/gvisor/pkg/secio Index | Files

package secio

import "gvisor.dev/gvisor/pkg/secio"

Package secio provides support for sectioned I/O.

Index

Variables

var ErrReachedLimit = errors.New("reached limit")

ErrReachedLimit is returned when SectionReader.Read or SectionWriter.Write reaches its limit.

Types

type FullReader

type FullReader struct {
	Reader io.Reader
}

FullReader adapts an io.Reader to never return partial reads with a nil error.

func (FullReader) Read

func (r FullReader) Read(dst []byte) (int, error)

Read implements io.Reader.Read.

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:

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.

func (*SectionReader) Read

func (r *SectionReader) Read(dst []byte) (int, error)

Read implements io.Reader.Read.

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.

func (*SectionWriter) Write

func (w *SectionWriter) Write(src []byte) (int, error)

Write implements io.Writer.Write.

Source Files

full_reader.go secio.go

Version
v0.0.0-20250605235530-a6711d1e1dc6 (latest)
Published
Jun 5, 2025
Platform
linux/amd64
Imports
2 packages
Last checked
4 hours ago

Tools for package owners.