ioutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capturer

type Capturer interface {
	Bytes() []byte
}

type HeadWriter

type HeadWriter struct {
	Buf   []byte
	Limit int
	// contains filtered or unexported fields
}

HeadWriter keeps the first 'Limit' bytes in memory.

func (*HeadWriter) Bytes

func (w *HeadWriter) Bytes() []byte

func (*HeadWriter) Write

func (w *HeadWriter) Write(p []byte) (n int, err error)

type OutputCapturer

type OutputCapturer struct {
	HeadWriter
	TailWriter
	Limit int
	// contains filtered or unexported fields
}

OutputCapturer keeps the first 'Limit' bytes and the last 'Limit' bytes in memory. If the total number of bytes written exceeds 'Limit', the middle is truncated. The writer is thread-safe.

func NewOutputCapturer

func NewOutputCapturer(limit int) *OutputCapturer

func (*OutputCapturer) Bytes

func (w *OutputCapturer) Bytes() []byte

func (*OutputCapturer) String added in v1.1.0

func (w *OutputCapturer) String() string

func (*OutputCapturer) Write

func (w *OutputCapturer) Write(p []byte) (n int, err error)

type SynchronizedWriter added in v1.0.0

type SynchronizedWriter struct {
	Mu sync.Mutex
	W  io.Writer
}

func (*SynchronizedWriter) Write added in v1.0.0

func (w *SynchronizedWriter) Write(p []byte) (n int, err error)

type TailWriter

type TailWriter struct {
	Buf   []byte
	Limit int
}

tailWriter keeps the last 'Limit' bytes in memory.

func (*TailWriter) Bytes

func (w *TailWriter) Bytes() []byte

func (*TailWriter) Write

func (w *TailWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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