truncatedbuffer

package
v0.14.1-0...-8b31b97 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TruncatedBuffer

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

TruncatedBuffer contains a bytes buffer that has a limited capacity The buffer is truncated on Write if the length reaches the maximum capacity Only the first bytes are preserved

func NewTruncatedBuffer

func NewTruncatedBuffer(cap int) *TruncatedBuffer

NewTruncatedBuffer returns a new TruncatedBuffer If the provided cap is 0, the truncated buffer has no limit for truncating

func (TruncatedBuffer) GetBuffer

func (b TruncatedBuffer) GetBuffer() *bytes.Buffer

GetCap returns the buffer

func (TruncatedBuffer) GetCap

func (b TruncatedBuffer) GetCap() int

GetCap returns the maximum capacity of the buffer

func (*TruncatedBuffer) Write

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

Write implements io.Writer

Jump to

Keyboard shortcuts

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