buffer

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFull = errors.New("buffer full")

Functions

This section is empty.

Types

type FixedBuffer

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

func NewFixedBuffer

func NewFixedBuffer(n int) *FixedBuffer

func (*FixedBuffer) Cap

func (b *FixedBuffer) Cap() int

func (*FixedBuffer) Free

func (b *FixedBuffer) Free()

func (*FixedBuffer) HasRemaining

func (b *FixedBuffer) HasRemaining() bool

func (*FixedBuffer) Len

func (b *FixedBuffer) Len() int

func (*FixedBuffer) Read

func (b *FixedBuffer) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. err is nil or io.EOF(buf all read).

func (*FixedBuffer) ReadFrom

func (b *FixedBuffer) ReadFrom(r io.Reader) (int64, error)

ReadFrom reads data from r until io.EOF or b is full, and appends it to the buffer. The return value n is the number of bytes read. Any error except io.EOF encountered during the read is also returned nil err means Reader io.EOF ErrFull means buf full and Reader not io.EOF.

func (*FixedBuffer) Write

func (b *FixedBuffer) Write(p []byte) (n int, err error)

Write writes len(p) bytes from p to buf. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. ErrFull means buf is full.

func (*FixedBuffer) WriteTo

func (b *FixedBuffer) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes data to w until there's no more data to write or when an error occurs. The return value n is the number of bytes written. Any error encountered during the write is also returned.

Jump to

Keyboard shortcuts

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