bufpool

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2018 License: AGPL-3.0 Imports: 2 Imported by: 8 modules, 12 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 bufpool is a freelist for bytes.Buffer objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyBytes

func CopyBytes(buf *bytes.Buffer) []byte

CopyBytes returns a copy of the bytes contained in the buffer. This slice is safe from updates in the underlying buffer, allowing the buffer to be placed back in the free list.

func Get

func Get() *bytes.Buffer

Get returns an initialized bytes.Buffer object. It is like new(bytes.Buffer) except it uses the free list. The caller should call Put when finished with the returned object. Since Buffer.Bytes() returns the buffer's underlying slice, it is not safe for that slice to escape the caller. If the bytes need to escape, CopyBytes should be used.

func Put

func Put(b *bytes.Buffer)

Put resets the buffer and adds it to the freelist.

Types

This section is empty.

Jump to

Keyboard shortcuts

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