bufwriter

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 12

Documentation

Overview

Package bufwriter implements a simplified buffered writer, similar to the bufio package in the Go standard library, but adds automatic flushing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAutoFlushWriter

func NewAutoFlushWriter(w FlushWriter) io.Writer

NewAutoFlushWriter wraps a FlushWriter and returns an io.Writer. The returned writer will automatically call the wrapped Flush method after each Write call.

Types

type FlushWriter

type FlushWriter interface {
	Flush() error
	io.Writer
}

type Writer

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

func NewWriter

func NewWriter(writer io.Writer, flushDelay time.Duration) *Writer

NewWriter wraps a io.Writer and returns a *Writer. Written data are flushed within the time specified by flushDelay. If writer does not implement the FlushWriter interface then a bufio.Writer is created.

func (*Writer) Flush

func (b *Writer) Flush() error

func (*Writer) Write

func (b *Writer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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