io

package
v0.0.0-...-72e79e1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package io provides useful functions with io operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedBufferedReader

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

ExtendedBufferedReader extend bufio.Reader.Read method

func NewExtendedBufferedReader

func NewExtendedBufferedReader(reader *bufio.Reader) *ExtendedBufferedReader

NewExtendedBufferedReader return new ExtendedBufferedReader

func (*ExtendedBufferedReader) Buffered

func (r *ExtendedBufferedReader) Buffered() int

Buffered returns the number of bytes that can be read from the current buffer.

func (*ExtendedBufferedReader) Peek

func (r *ExtendedBufferedReader) Peek(n int) ([]byte, error)

Peek returns the next n bytes without advancing the reader. The bytes stop being valid at the next read call. If Peek returns fewer than n bytes, it also returns an error explaining why the read is short. The error is ErrBufferFull if n is larger than b's buffer size.

func (*ExtendedBufferedReader) Read

func (r *ExtendedBufferedReader) Read(buf []byte) (int, error)
Read until buf full or return error

when postgresql return a lot of data he will return as sequence of packets

func (*ExtendedBufferedReader) ReadByte

func (r *ExtendedBufferedReader) ReadByte() (byte, error)

ReadByte reads and returns a single byte. If no byte is available, returns an error.

func (*ExtendedBufferedReader) ReadBytes

func (r *ExtendedBufferedReader) ReadBytes(delim byte) ([]byte, error)

ReadBytes reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If ReadBytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). ReadBytes returns err != nil if and only if the returned data does not end in delim. For simple uses, a Scanner may be more convenient.

func (*ExtendedBufferedReader) Reset

func (r *ExtendedBufferedReader) Reset(reader io.Reader)

Reset discards any buffered data, resets all state, and switches the buffered reader to read from r.

func (*ExtendedBufferedReader) UnreadByte

func (r *ExtendedBufferedReader) UnreadByte() error

UnreadByte unreads the last byte. Only the most recently read byte can be unread.

func (*ExtendedBufferedReader) WriteTo

func (r *ExtendedBufferedReader) WriteTo(w io.Writer) (n int64, err error)

WriteTo implements io.WriterTo.

Jump to

Keyboard shortcuts

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