buffer

package
v1.16.19 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Gap

func Gap(buf Buffer) int64

Gap returns buf.Cap() - buf.Len()

Types

type Buffer

type Buffer interface {
	Len() int64 // How much data is Buffered in bytes
	Cap() int64 // How much data can be Buffered at once in bytes.
	io.Reader   // Read() will read from the top of the buffer [io.EOF if empty]
	io.Writer   // Write() will write to the end of the buffer [io.ErrShortWrite if not enough space]
	Reset()     // Truncates the buffer, Len() == 0.
}

Buffer is used to Write() data which will be Read() later.

type BufferAt

type BufferAt interface {
	Buffer
	io.ReaderAt
	io.WriterAt
}

BufferAt is a buffer which supports io.ReaderAt and io.WriterAt

func New

func New(n int64) BufferAt

New returns a new in memory BufferAt with max size N. It's backed by a bytes.Buffer.

Jump to

Keyboard shortcuts

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