bytes

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

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) 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.

type BufferPool

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

BufferPool is a pool of Buffer.

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