-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgobls.go
30 lines (28 loc) · 1.16 KB
/
gobls.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package gobls
// DefaultBufferSize specifies the initial bytes size each gobls scanner will
// allocate to be used for aggregation of line fragments.
const DefaultBufferSize = 16 * 1024
// Scanner provides an interface for reading newline-delimited lines of text.
// It is similar to bufio.Scanner, but wraps the ReadLine method of bufio.Reader
// so lines of arbitrary length can be scanned. Successive calls to the Scan
// method will step through the lines of a file, skipping the newline whitespace
// between lines.
//
// Scanning stops unrecoverably at EOF, or at the first I/O error. Unlike
// bufio.Scanner, however, attempting to scan a line longer than
// bufio.MaxScanTokenSize will not result in an error, but will return the long
// line.
//
// Also like bufio.Scanner, it is not necessary to check for errors by calling
// the Err method until after scanning stops, when the Scan method returns
// false.
//
// This Scanner ought behave exactly like bufio.Scanner. All methods ought to
// have the exact same return values while stepping through the given the
// provided io.Reader.
type Scanner interface {
Bytes() []byte
Err() error
Scan() bool
Text() string
}