reverse

package
v0.0.0-...-f3d8a94 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner presents the same interface as bufio.Scanner except it scans tokens in reverse from the end of a file instead of forwards from the beginning.

It may not work correctly if the split function can return an error from reading half way through a token. That is not the case for any of the Scan* functions in bufio.

func NewScanner

func NewScanner(r io.ReadSeeker) *Scanner

NewScanner returns a new Scanner to read tokens in reverse from r. The split function defaults to bufio.ScanLines.

func (*Scanner) Bytes

func (b *Scanner) Bytes() []byte

Bytes returns the most recent token generated by a call to Scan. The underlying array may point to data that will be overwritten by a subsequent call to Scan. It does no allocation.

func (*Scanner) Err

func (b *Scanner) Err() error

func (*Scanner) Scan

func (b *Scanner) Scan() bool

Scan advances the Scanner to the next token, which will then be available through the Bytes or Text method. It returns false when the scan stops, either by reaching the end of the input or an error. After Scan returns false, the Err method will return any error that occurred during scanning, except that if it was io.EOF, Err will return nil.

func (*Scanner) Split

func (b *Scanner) Split(split bufio.SplitFunc)

Split sets the split function for the Scanner. If called, it must be called before Scan. The default split function is bufio.ScanLines.

func (*Scanner) Text

func (b *Scanner) Text() string

Text returns the most recent token generated by a call to Scan as a newly allocated string holding its bytes.

Jump to

Keyboard shortcuts

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