bytes

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 5 Imported by: 1 module, 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 bytes provides utilities for operating bytes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(a []byte) []byte

Copy copies a to a new slice.

func ResizeExact

func ResizeExact(b []byte, n int) []byte

ResizeExact resizes the byte slice to the exact size.

func ResizeOver

func ResizeOver(b []byte, n int) []byte

ResizeOver resizes the byte slice to the nearest power of 2.

Types

type Buffer

type Buffer struct {
	Buf []byte
}

Buffer is a in-memory buffer.

func (*Buffer) Bytes added in v0.9.0

func (b *Buffer) Bytes() []byte

Bytes implements encoding.BufferWriter.

func (*Buffer) Close

func (*Buffer) Close() error

Close implements fs.Writer.

func (*Buffer) Path

func (b *Buffer) Path() string

Path implements fs.Writer.

func (*Buffer) Read

func (b *Buffer) Read(offset int64, buffer []byte) (int, error)

Read implements fs.Reader.

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset resets the buffer.

func (*Buffer) SequentialRead

func (b *Buffer) SequentialRead() fs.SeqReader

SequentialRead implements fs.Reader.

func (*Buffer) SequentialWrite

func (b *Buffer) SequentialWrite() fs.SeqWriter

SequentialWrite implements fs.Writer.

func (*Buffer) Write

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

Write implements fs.Writer.

func (*Buffer) WriteByte added in v0.9.0

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

WriteByte implements encoding.BufferWriter.

type BufferPool

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

BufferPool is a pool of Buffer.

func NewBufferPool added in v0.7.0

func NewBufferPool(name string) *BufferPool

NewBufferPool creates a new BufferPool.

func (*BufferPool) Generate

func (bp *BufferPool) Generate() *Buffer

Generate generates a Buffer.

func (*BufferPool) Release

func (bp *BufferPool) Release(b *Buffer)

Release releases a Buffer.

Jump to

Keyboard shortcuts

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