bufio

package
v1.2.117 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMismatchTokenPair = errors.New("mismatch token pair")
	ErrInvalidStartToken = errors.New("invalid start token")
)

Functions

This section is empty.

Types

type DelimiterPair

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

type PairScanner

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

A PairScanner reads and decodes Pair wrapped values from an input stream, like a json、xml.

func NewPairScanner

func NewPairScanner(r io.Reader) *PairScanner

NewPairScanner returns a new scanner that reads from r.

The scanner introduces its own buffering and may read data from r beyond the paired values requested.

func (*PairScanner) Buffered

func (s *PairScanner) Buffered() io.Reader

Buffered returns a reader of the data remaining in the PairScanner's buffer. The reader is valid until the next call to Decode.

func (*PairScanner) InputOffset added in v1.2.116

func (s *PairScanner) InputOffset() int64

InputOffset returns the input stream byte offset of the current scanner position. The offset gives the location of the end of the most recently returned token and the beginning of the next token.

func (*PairScanner) More added in v1.2.116

func (s *PairScanner) More() bool

More reports whether there is another element in the current array or object being parsed.

func (*PairScanner) Scan

func (s *PairScanner) Scan(pairs []DelimiterPair) (line []byte, err error)

Scan reads the next value complete wrapped by pair delimiters from its input and stores it in the value pointed to by v.

func (*PairScanner) ScanDelimiters

func (s *PairScanner) ScanDelimiters(delimiters string) (line []byte, err error)

func (*PairScanner) SetDiscardLeading

func (s *PairScanner) SetDiscardLeading(discard bool) *PairScanner

type ReaderPool

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

func NewReaderPool

func NewReaderPool() *ReaderPool

func NewReaderPoolSize

func NewReaderPoolSize(size int) *ReaderPool

func (*ReaderPool) Clear

func (p *ReaderPool) Clear()

func (*ReaderPool) Get

func (p *ReaderPool) Get(r io.Reader) *bufio.Reader

func (*ReaderPool) Put

func (p *ReaderPool) Put(br *bufio.Reader)

type WriterPool

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

func NewWriterPool

func NewWriterPool() *WriterPool

func NewWriterPoolSize

func NewWriterPoolSize(size int) *WriterPool

func (*WriterPool) Clear

func (p *WriterPool) Clear()

func (*WriterPool) Get

func (p *WriterPool) Get(w io.Writer) *bufio.Writer

func (*WriterPool) Put

func (p *WriterPool) Put(br *bufio.Writer)

Jump to

Keyboard shortcuts

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