gather

package
v0.6.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package gather implements data structures storing binary data organized in a series of byte slices of fixed size that only gathered together by the user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bytes

type Bytes struct {
	Slices [][]byte
	// contains filtered or unexported fields
}

Bytes represents a sequence of bytes split into slices.

func FromSlice

func FromSlice(b []byte) Bytes

FromSlice creates Bytes from the specified slice.

func (*Bytes) AppendSectionTo

func (b *Bytes) AppendSectionTo(output []byte, offset, size int) []byte

AppendSectionTo appends the section of the buffer to the provided slice and returns it.

func (Bytes) GetBytes

func (b Bytes) GetBytes(output []byte) []byte

GetBytes appends all bytes to the provided slice and returns it.

func (Bytes) Length

func (b Bytes) Length() int

Length returns the combined length of all slices.

func (Bytes) Reader

func (b Bytes) Reader() io.Reader

Reader returns a reader for the data.

func (Bytes) WriteTo

func (b Bytes) WriteTo(w io.Writer) (int64, error)

WriteTo writes contents to the specified writer and returns number of bytes written.

type WriteBuffer

type WriteBuffer struct {
	Bytes
}

WriteBuffer is a write buffer for content of unknown size that manages data in a series of byte slices of uniform size.

func NewWriteBuffer

func NewWriteBuffer() *WriteBuffer

NewWriteBuffer creates new write buffer.

func (*WriteBuffer) Append

func (b *WriteBuffer) Append(data []byte)

Append appends the specified slice of bytes to the buffer.

func (*WriteBuffer) Close

func (b *WriteBuffer) Close()

Close releases all memory allocated by this buffer.

func (*WriteBuffer) Reset

func (b *WriteBuffer) Reset()

Reset resets buffer back to empty.

func (*WriteBuffer) Write

func (b *WriteBuffer) Write(data []byte) (n int, err error)

Write implements io.Writer for appending to the buffer.

Jump to

Keyboard shortcuts

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