seeker

package
v0.0.0-...-6d3478e Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2018 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BufferedPeeker

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

BufferedPeeker implements a custom buffer structure which allows peeks, reversal of index location of provided byte slice. It helps to minimize memory allocation.

func NewBufferedPeeker

func NewBufferedPeeker(d []byte) *BufferedPeeker

NewBufferedPeeker returns new instance of BufferedPeeker.

func (*BufferedPeeker) Area

func (b *BufferedPeeker) Area() int

Area returns current available length from current index.

func (*BufferedPeeker) Length

func (b *BufferedPeeker) Length() int

Length returns total length of slice.

func (*BufferedPeeker) Next

func (b *BufferedPeeker) Next(n int) []byte

Next returns bytes around giving range. If area is beyond slice length, then the rest of slice is returned.

func (*BufferedPeeker) Peek

func (b *BufferedPeeker) Peek(n int) []byte

Peek returns the next bytes of giving n length. It will not move index beyond current bounds, but returns current area if within slice length. If area is beyond slice length, then the rest of slice is returned.

func (*BufferedPeeker) Reset

func (b *BufferedPeeker) Reset(bm []byte)

Reset sets giving buffers memory slice and sets appropriate settings.

func (*BufferedPeeker) Reverse

func (b *BufferedPeeker) Reverse(n int)

Reverse reverses previous index back a giving length It reverse any length back to 0 if length provided exceeds underline slice length.

Jump to

Keyboard shortcuts

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