morebufio

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReadSeekerSize

func NewReadSeekerSize(r ioctx.ReadSeeker, size int) *readSeeker

NewReadSeekerSize returns a buffered io.ReadSeeker whose buffer has at least the specified size. If r is already a readSeeker with sufficient size, returns r.

func NewReaderAtSize added in v0.0.11

func NewReaderAtSize(r ioctx.ReaderAt, size int) ioctx.ReaderAt

NewReaderAt constructs a buffered ReaderAt. While ReaderAt allows arbitrary concurrent reads, this implementation has only one buffer (for simplicity), so reads will only be usefully buffered if reads are serial and generally contiguous (just like a plain ioctx.Reader). Concurrent reads will be "passed through" to the underlying ReaderAt, just without buffering.

Types

type PeekBackReader added in v0.0.11

type PeekBackReader interface {
	ioctx.Reader
	// PeekBack returns a fixed "window" of the data that Read has already returned, ending at
	// the current Read position. It may be smaller at the start until enough data has been read,
	// but after that it's constant size. PeekBack is allowed after Read returns EOF.
	// The returned slice aliases the internal buffer and is invalidated by the next Read.
	PeekBack() []byte
}

PeekBackReader is a Reader augmented with a function to "peek" backwards at the data that was already passed. Peeking does not change the current stream position (that is, PeekBack has no effect on the next Read).

func NewPeekBackReader added in v0.0.11

func NewPeekBackReader(r ioctx.Reader, peekBackSize int) PeekBackReader

NewPeekBackReader returns a PeekBackReader. It doesn't have a "forward" buffer so small PeekBackReader.Read operations cause small r.Read operations.

Jump to

Keyboard shortcuts

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