bufio

package
v2.15.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package bufio is a replacement of the standard golang package bufio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OriginalReader

func OriginalReader(reader io.Reader) *bufio.Reader

OriginalReader invokes bufio.NewReader() from Golang standard library.

func OriginalReaderSize

func OriginalReaderSize(reader io.Reader, size int) *bufio.Reader

OriginalReaderSize invokes bufio.NewReaderSize() from Golang standard library.

Types

type BufferedReader

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

BufferedReader is a reader with internal cache.

func NewReader

func NewReader(rawReader io.Reader) *BufferedReader

NewReader creates a new BufferedReader based on an io.Reader.

func (*BufferedReader) IsBuffered

func (v *BufferedReader) IsBuffered() bool

IsBuffered returns true if the internal cache is effective.

func (*BufferedReader) Read

func (v *BufferedReader) Read(b []byte) (int, error)

Read implements io.Reader.Read().

func (*BufferedReader) SetBuffered

func (v *BufferedReader) SetBuffered(cached bool)

SetBuffered is to enable or disable internal cache. If cache is disabled, Read() calls will be delegated to the underlying io.Reader directly.

type BufferedWriter

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

BufferedWriter is an io.Writer with internal buffer. It writes to underlying writer when buffer is full or on demand. This type is not thread safe.

func NewWriter

func NewWriter(rawWriter io.Writer) *BufferedWriter

NewWriter creates a new BufferedWriter.

func (*BufferedWriter) Flush

func (v *BufferedWriter) Flush() error

Flush writes all buffered content into underlying writer, if any.

func (*BufferedWriter) IsBuffered

func (v *BufferedWriter) IsBuffered() bool

IsBuffered returns true if this BufferedWriter holds a buffer.

func (*BufferedWriter) ReadFrom

func (v *BufferedWriter) ReadFrom(reader io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom.ReadFrom().

func (*BufferedWriter) SetBuffered

func (v *BufferedWriter) SetBuffered(cached bool) error

SetBuffered controls whether the BufferedWriter holds a buffer for writing. If not buffered, any write() calls into underlying writer directly.

func (*BufferedWriter) Write

func (v *BufferedWriter) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

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