Documentation ¶
Index ¶
- type Reader
- func (r *Reader) Discard(n uint) (uint, error)
- func (r *Reader) IsAtEnd() bool
- func (r *Reader) PeekRunes(n uint) ([]rune, error)
- func (r *Reader) PeekSingleRune() (rune, error)
- func (r *Reader) ReadRunes(n uint) (runes []rune, err error)
- func (r *Reader) ReadSingleRune() (rune, error)
- func (r *Reader) ReadTill(matcherFn func(rune) bool) (runes []rune)
- func (r *Reader) Reset(bufReader RuneReader)
- func (r *Reader) String() (string, error)
- type RuneReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct { RuneReader // Runes is temporary buffer used to store runes that are peeked, but not // yet read. Runes []rune }
Reader implements buffered manipulation of runes using RuneReader.
NOTE: while calling Peek* methods won't affect result of ReadRunes(), it'll however read them from underlying RuneReader, but not put them back.
func NewReader ¶
func NewReader(r RuneReader) *Reader
NewReader is the required initializer for Reader.
func (*Reader) Discard ¶
Discard skips the given n runes, returning number of runes discarded.
If given n is greater than amount of runes in the buffer, it'll discard all the runes and return `io.EOF`.
func (*Reader) IsAtEnd ¶
IsAtEnd returns if at the end of string, ie reading 1 more character would return `io.EOF` error.
func (*Reader) PeekRunes ¶
PeekRunes peeks given n runes from buffers and returns slice of them. It does not however remove them the buffer and the same data will be returned on ReadRunes() operation.
If given n is greater than amount of runes in the buffer, it'll peek all the runes and `io.EOF` as error.
func (*Reader) PeekSingleRune ¶
PeekSingleRune peeks a single rune from buffer and return it.
If the are no runes left in the buffer, it'll return unicode.ReplacementChar and `io.EOF` error.
func (*Reader) ReadRunes ¶
ReadRunes reads given n runes from buffers and returns slice of them.
If given n is greater than amount of runes in the buffer, it'll return all the runes and `io.EOF` as error.
func (*Reader) ReadSingleRune ¶
ReadSingleRune reads a single rune from buffer and return it.
If the are no runes left in the buffer, it'll return unicode.ReplacementChar and `io.EOF` error.
func (*Reader) Reset ¶
func (r *Reader) Reset(bufReader RuneReader)
Reset replaces the underlying reader with the given reader.