bufin

package
v0.0.0-...-797e8bf Latest Latest
Warning

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

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

Documentation

Overview

package bufin implements a partially static buffed input reader. It is very similar to the standard library bufio.Reader so that is almost always prefered over the following package. bufin is implemented to track and have full control over reading data from a socket. It's used internally by the exp redis client.

Index

Constants

View Source
const IOBUFLEN = 1024

Variables

View Source
var (
	ErrFullBuf  = errors.New("Full buffer")
	ErrNotFound = errors.New("Not found")
)

Functions

This section is empty.

Types

type Reader

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

func NewReader

func NewReader(rd io.Reader) (r *Reader)

func (*Reader) Buffered

func (b *Reader) Buffered() int

func (*Reader) Copy

func (b *Reader) Copy(p []byte) (n int, e error)

copies len(p) bytes from r.buf[r:] to p if len(p) > r.buf[r:]

func (*Reader) Incr

func (b *Reader) Incr(n int) int

func (*Reader) IndexSlice

func (b *Reader) IndexSlice(delim byte) (line []byte, err error)

func (*Reader) Read

func (b *Reader) Read(p []byte) (n int, e error)

either reads from the static buffer or if len(p) > len(buf), read len(p) bytes from socket directly into p

func (*Reader) ReadSlice

func (b *Reader) ReadSlice(delim byte) (line []byte, err error)

func (*Reader) Reset

func (b *Reader) Reset() bool

reset to recover space if buf is empty

func (*Reader) String

func (b *Reader) String() string

Jump to

Keyboard shortcuts

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