bufferio

package
v0.0.0-...-a532a67 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBufferInput

func NewBufferInput(parent app.Input, buffer *Buffer) app.Input

NewBufferInput retur new chached input

func NewBufferOutput

func NewBufferOutput(buffer *Buffer) app.Output

NewBufferOutput returns a new BufferOutput.

Types

type Broadcast

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

Broadcast is helper to brodcast call to many writers

func NewBroadcast

func NewBroadcast(buffer *Buffer, writers []io.Writer) *Broadcast

NewBroadcast return new Broadcast instance

func (*Broadcast) Add

func (broadcast *Broadcast) Add(writer io.Writer) (err error)

Add writer (write buffored data to new outputs buffored )

func (*Broadcast) Bytes

func (broadcast *Broadcast) Bytes() []byte

Bytes return writed content

func (*Broadcast) Printf

func (broadcast *Broadcast) Printf(format string, a ...interface{}) (err error)

Printf print to multiple outputs.

func (*Broadcast) String

func (broadcast *Broadcast) String() string

String return writed content

func (*Broadcast) Write

func (broadcast *Broadcast) Write(p []byte) (n int, err error)

Writer is the interface that wraps the basic Write method.

type Buffer

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

Buffer cache input data

func NewBuffer

func NewBuffer() *Buffer

NewBuffer create new buffer instance

func (*Buffer) Bytes

func (buffer *Buffer) Bytes() []byte

Bytes return buffer

func (*Buffer) Printf

func (buffer *Buffer) Printf(format string, a ...interface{}) (err error)

Printf to buffer

func (*Buffer) Read

func (buffer *Buffer) Read(p []byte) (n int, err error)

Read from buffer

func (*Buffer) ReadAndClean

func (buffer *Buffer) ReadAndClean() (s string)

ReadAndClean return buffor and clean buffor content

func (*Buffer) String

func (buffer *Buffer) String() string

Read return buffer

func (*Buffer) Write

func (buffer *Buffer) Write(p []byte) (n int, err error)

WriteString write string to buffer

func (*Buffer) WriteString

func (buffer *Buffer) WriteString(s string) (err error)

WriteString write string to buffer

type BufferInput

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

BufferInput cache input data

func (*BufferInput) Read

func (input *BufferInput) Read(p []byte) (n int, err error)

func (*BufferInput) ReadLine

func (input *BufferInput) ReadLine() (s string, err error)

ReadLine return next line from input stream

func (*BufferInput) ReadWord

func (input *BufferInput) ReadWord() (s string, err error)

ReadWord return next word from input stream

type BufferOutput

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

BufferOutput represent system output

func (*BufferOutput) Printf

func (out *BufferOutput) Printf(format string, a ...interface{}) error

Printf formats according to a format specifier and writes to standard output. It returns the number of bytes written and any write error encountered.

func (*BufferOutput) Write

func (out *BufferOutput) Write(p []byte) (n int, err error)

Write data to output

Jump to

Keyboard shortcuts

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