streams

package
v1.8.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallbackWithSeekable

func CallbackWithSeekable(r io.Reader, callback func(io.Reader) error) (stream io.Reader, err error)

Run the callback function with a buffered reader that supports Seek() and Read(). Return an io.Reader that represents all content from the original io.Reader.

func ReadByte

func ReadByte(r io.Reader) (ans byte, err error)

Read a single byte from the reader

func Skip

func Skip(r io.Reader, amt int64) (err error)

Skip reading the specified number of bytes efficiently

Types

type BufferedReadSeeker

type BufferedReadSeeker struct {
	// contains filtered or unexported fields
}

BufferedReadSeeker wraps an io.ReadSeeker to provide buffering. It implements the io.ReadSeeker interface.

func NewBufferedReadSeeker

func NewBufferedReadSeeker(rs io.ReadSeeker) *BufferedReadSeeker

NewBufferedReadSeeker creates a new BufferedReadSeeker with a default buffer size.

func (*BufferedReadSeeker) Read

func (brs *BufferedReadSeeker) Read(p []byte) (n int, err error)

Read reads data into p. It reads from the underlying buffered reader.

func (*BufferedReadSeeker) Seek

func (brs *BufferedReadSeeker) Seek(offset int64, whence int) (int64, error)

Seek sets the offset for the next Read. It is optimized to use the buffer for seeks that land within the buffered data range.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL