bufio2

package
v2.0.0-beta.1+incompat... Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2016 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package bufio2 implements buffered I/O.

It wraps an io.Reader or io.Writer object, creating another object (Reader or AsyncWriter) that also implements the interface but provides buffering and some help for textual I/O.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncWriter

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

AsyncWriter implements buffering for an io.Writer object. If an error occurs writing to a AsyncWriter, no more data will be accepted and all subsequent writes will return the error.

func NewAsyncWriter

func NewAsyncWriter(wr io.Writer) *AsyncWriter

NewAsyncWriter returns a new AsyncWriter whose buffer has the default size.

func NewAsyncWriterSize

func NewAsyncWriterSize(wr io.Writer, size int, count int) *AsyncWriter

NewAsyncWriterSize returns a new AsyncWriter whose buffer has at least the specified size. If the argument io.Writer is already a AsyncWriter with large enough size, it returns the underlying AsyncWriter.

func (*AsyncWriter) Available

func (b *AsyncWriter) Available() int

Available returns how many bytes are unused in the buffer.

func (*AsyncWriter) Buffered

func (b *AsyncWriter) Buffered() int

Buffered returns the number of bytes that have been written into the current buffer.

func (*AsyncWriter) Flush

func (b *AsyncWriter) Flush() error

func (*AsyncWriter) ReadFrom

func (b *AsyncWriter) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom implements io.ReaderFrom.

func (*AsyncWriter) WaitForWrites

func (b *AsyncWriter) WaitForWrites() error

func (*AsyncWriter) Write

func (b *AsyncWriter) Write(p []byte) (nn int, err error)

Write writes the contents of p into the buffer. It returns the number of bytes written. If nn < len(p), it also returns an error explaining why the write is short.

func (*AsyncWriter) WriteByte

func (b *AsyncWriter) WriteByte(c byte) error

WriteByte writes a single byte.

func (*AsyncWriter) WriteRune

func (b *AsyncWriter) WriteRune(r rune) (size int, err error)

WriteRune writes a single Unicode code point, returning the number of bytes written and any error.

func (*AsyncWriter) WriteString

func (b *AsyncWriter) WriteString(s string) (int, error)

WriteString writes a string. It returns the number of bytes written. If the count is less than len(s), it also returns an error explaining why the write is short.

Jump to

Keyboard shortcuts

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