bufio

package
v2.12.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2016 License: MIT Imports: 6 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 {
	sync.Mutex
	// 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) Cached

func (v *BufferedReader) Cached() bool

Cached 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) Release

func (v *BufferedReader) Release()

Release implements Releasable.Release().

func (*BufferedReader) SetCached

func (v *BufferedReader) SetCached(cached bool)

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

type BufferedWriter

type BufferedWriter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(rawWriter io.Writer) *BufferedWriter

func (*BufferedWriter) Cached

func (v *BufferedWriter) Cached() bool

func (*BufferedWriter) Flush

func (v *BufferedWriter) Flush() error

func (*BufferedWriter) FlushWithoutLock

func (v *BufferedWriter) FlushWithoutLock() error

func (*BufferedWriter) ReadFrom

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

func (*BufferedWriter) Release

func (v *BufferedWriter) Release()

func (*BufferedWriter) SetCached

func (v *BufferedWriter) SetCached(cached bool)

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