circular

package
Version: v0.0.0-...-45f56e5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 0 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

A Buffer is a fixed size buffer with Read and Write methods. When more than the allotted amount of data is written, the buffer will only retain the last size bytes of unread data. The zero value for Buffer is a buffer of size 0; all writes are discarded and there is never any data to read. This implementation is not thread-safe.

func NewBuffer

func NewBuffer(size int) *Buffer

NewBuffer returns a pointer to a Buffer with a maximum size of size.

func (*Buffer) IsEmpty

func (b *Buffer) IsEmpty() bool

IsEmpty will return true if the buffer is empty

func (*Buffer) IsFull

func (b *Buffer) IsFull() bool

IsFull will return true if the buffer is full

func (*Buffer) Read

func (b *Buffer) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes in to p; the actual number of bytes read is returned (n) along with any error condition.

func (*Buffer) Write

func (b *Buffer) Write(p []byte) (n int, err error)

Write writes p[]byte to the buffer and returns the number of bytes written. Only the last b.size bytes are kept.

Source Files

Jump to

Keyboard shortcuts

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