Documentation

Overview

Package xbufio provides addons to std package bufio.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

Reader is a bufio.Reader that also reports current logical position in input stream.

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) InputOffset

func (r *Reader) InputOffset() int64

InputOffset returns current logical position in input stream.

type SeqReaderAt

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

SeqReaderAt implements buffering for a io.ReaderAt optimized for sequential access.

Both forward, backward and interleaved forward/backward access patterns are supported

NOTE SeqReaderAt is not safe to use from multiple goroutines concurrently.

Strictly speaking this goes against io.ReaderAt interface but sequential
workloads usually mean sequential processing. It would be a pity to
add mutex for nothing.

func NewSeqReaderAt

func NewSeqReaderAt(r io.ReaderAt) *SeqReaderAt

NewSeqReaderAt wraps r with SeqReaderAt with buffer of default size.

func NewSeqReaderAtSize

func NewSeqReaderAtSize(r io.ReaderAt, size int) *SeqReaderAt

NewSeqReaderAtSize wraps r with SeqReaderAt with buffer of specified size.

func (*SeqReaderAt) ReadAt

func (sb *SeqReaderAt) ReadAt(p []byte, pos int64) (int, error)