backbuf

package
v0.0.0-...-d2621c3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 1 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
}

Buffer implements a circular byte buffer, data is read from left to right but chucks are read from right to left. Unread data is never overwriten

func New

func New(size int) (*Buffer, error)

New creates a Buffer with a capacity of `size´ bytes

func (*Buffer) Omit

func (cb *Buffer) Omit(n int) error

Omit updates read position as if n bytes were read

func (*Buffer) Read

func (cb *Buffer) Read(buf []byte) (int, error)

Read reads up to len(buf) bytes

func (*Buffer) ReadAvailability

func (cb *Buffer) ReadAvailability() int

ReadAvailability returns the number of bytes that can be read

func (*Buffer) ReadByte

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

ReadByte returns the first unread byte

func (*Buffer) Reset

func (cb *Buffer) Reset()

Reset makes the buffer fully available

func (*Buffer) Size

func (cb *Buffer) Size() int

Size returns the capacity of the buffer

func (*Buffer) Write

func (cb *Buffer) Write(buf []byte) (n int, err error)

Write stores bytes into the buffer without overriding unread data

func (*Buffer) WriteAvailability

func (cb *Buffer) WriteAvailability() int

WriteAvailability returns the number of bytes that can be writen without overwriting unread data

Jump to

Keyboard shortcuts

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