buffer

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is similar to a strings.Builder, but is pooled and reusable. To create a Buffer use `New()` and when work its done call Buffer.Release()

func New

func New() (b *Buffer)

func (*Buffer) Cap

func (b *Buffer) Cap() int

Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written.

func (*Buffer) Len

func (b *Buffer) Len() int

Len returns the number of accumulated bytes; b.Len() == len(b.String()).

func (*Buffer) Release

func (b *Buffer) Release()

Release releases the buffer making it available for reutilization

func (*Buffer) String

func (b *Buffer) String() string

String returns the accumulated string.

func (*Buffer) Write

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

Write appends the contents of p to b's buffer. Write always returns len(p), nil.

func (*Buffer) WriteByte

func (b *Buffer) WriteByte(c byte) error

WriteByte appends the byte c to b's buffer. The returned error is always nil.

func (*Buffer) WriteString

func (b *Buffer) WriteString(s string) (int, error)

WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.

Jump to

Keyboard shortcuts

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