internal

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBytes

func GetBytes(n int) []byte

GetBytes returns a byte slice of at least n bytes from the pool.

func GetReader

func GetReader(rd io.Reader) *bufio.Reader

GetReader returns a reader from the pool and resets it to the provided reader.

func PutBytes

func PutBytes(b []byte)

PutBytes returns a byte slice to the pool.

func PutReader

func PutReader(r *bufio.Reader)

PutReader returns a reader to the pool and resets it.

Types

type BytesWriter

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

BytesWriter is a simple wrapper around a byte slice that implements io.Writer.

func (*BytesWriter) Bytes

func (w *BytesWriter) Bytes() []byte

Bytes returns the written portion of the byte slice.

func (*BytesWriter) Init

func (w *BytesWriter) Init(buf []byte)

Init initializes the BytesWriter with a byte slice.

func (*BytesWriter) Write

func (w *BytesWriter) Write(p []byte) (int, error)

Write implements io.Writer.

type LimitedReader

type LimitedReader struct {
	R io.Reader // underlying reader
	N int64     // max bytes remaining
}

A LimitedReader reads from R but limits the amount of data returned to just N bytes. Each call to Read updates N to reflect the new amount remaining. Read returns EOF when N <= 0 or when the underlying R returns EOF. See std io.LimitedReader for details.

func (*LimitedReader) Init

func (r *LimitedReader) Init(src io.Reader, n int64)

Init initializes a LimitedReader.

func (*LimitedReader) Read

func (l *LimitedReader) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes from the reader into p.

Jump to

Keyboard shortcuts

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