circular

package
v0.0.0-...-ffdb95b Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2014 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const TestVersion = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer implements a circular buffer supporting both overflow-checked writes and unconditional, possibly overwriting, writes.

func NewBuffer

func NewBuffer(size int) *Buffer

NewBuffer constructs a new empty circular buffer.

func (*Buffer) Overwrite

func (b *Buffer) Overwrite(c byte)

Overwrite unconditionally puts byte c in the buffer. If the buffer was already full, c overwrites the oldest byte in the buffer.

func (*Buffer) ReadByte

func (b *Buffer) ReadByte() (byte, error)

ReadByte removes one byte from the buffer and returns it. ReadByte returns an error if the buffer is empty.

func (*Buffer) Reset

func (b *Buffer) Reset()

Reset puts the buffer in an empty state.

func (*Buffer) WriteByte

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

WriteByte puts byte c in the buffer there is room. WriteByte returns an error if the buffer is full.

Jump to

Keyboard shortcuts

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