buffer

package
v3.11.42 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayedBuffer

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

DelayedBuffer is the buffer that holds items until either the buffer filled or a specified time limit is reached

func NewDelayedBuffer

func NewDelayedBuffer(size int, maxWait time.Duration, w io.Writer) *DelayedBuffer

func (*DelayedBuffer) Close

func (b *DelayedBuffer) Close() error

func (*DelayedBuffer) Put

func (b *DelayedBuffer) Put(items ...[]byte)

func (*DelayedBuffer) Write

func (b *DelayedBuffer) Write(data []byte) (int, error)

type SeekerBuffer added in v3.11.39

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

Buffer is a ReadWriteCloser that supports seeking. It's intended to replicate the functionality of bytes.Buffer that I use in my projects.

Note that the seeking is limited to the read marker; all writes are append-only.

func NewSeekerBuffer added in v3.11.39

func NewSeekerBuffer(data []byte) *SeekerBuffer

func (*SeekerBuffer) Bytes added in v3.11.39

func (b *SeekerBuffer) Bytes() []byte

Bytes returns the underlying bytes from the current position.

func (*SeekerBuffer) Close added in v3.11.39

func (b *SeekerBuffer) Close() error

Close clears all the data out of the buffer and sets the read position to 0.

func (*SeekerBuffer) Len added in v3.11.39

func (b *SeekerBuffer) Len() int

Len returns the length of data remaining to be read.

func (*SeekerBuffer) Read added in v3.11.39

func (b *SeekerBuffer) Read(p []byte) (int, error)

func (*SeekerBuffer) Rewind added in v3.11.39

func (b *SeekerBuffer) Rewind() error

Rewind resets the read pointer to 0.

func (*SeekerBuffer) Seek added in v3.11.39

func (b *SeekerBuffer) Seek(offset int64, whence int) (int64, error)

Seek sets the read pointer to pos.

func (*SeekerBuffer) Write added in v3.11.39

func (b *SeekerBuffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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