truncatedbuffer

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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