buffer

package
v0.1.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package buffer reuses exclusively owned temporary byte storage.

Index

Constants

This section is empty.

Variables

View Source
var ErrLimit = errors.New("buffer: read exceeds limit")

Functions

func Put

func Put(b *Buffer)

Types

type Buffer

type Buffer struct{ Bytes []byte }

Buffer must not be accessed after Put or shared while being resized.

func Get

func Get(size int) *Buffer

func (*Buffer) ReadAll

func (b *Buffer) ReadAll(r io.Reader, size, limit int) error

ReadAll uses a size hint, detects files growing beyond limit, and retains its storage for the next file. A successful read owns exactly the bytes returned.

func (*Buffer) Resize

func (b *Buffer) Resize(size int)

Jump to

Keyboard shortcuts

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