scanner

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package scanner provides an interface{} for scanning through a stream of bytes. The interface is compatible with bufio.Scanner.

Examples:

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

type Scanner interface {
	Buffer(buf []byte, max int) // sets the initial buffer
	Scan() bool                 // advanced the scanner to the next block
	Bytes() []byte              // returns the bytes of the current block
	Text() string               // returns the text of the current block
}

Scanner is an interface compatible with bufio.Scanner that is used by iterators. By using this interface, we can support streams separated by null bytes, new-line characters, or any separator.

func New

func New(reader io.Reader, separator byte, dropCR bool) Scanner

New returns a new Scanner that reads from the given reader, splits on the given newLine byte, and drops carriage returns if indicated.

Jump to

Keyboard shortcuts

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