lineio

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2019 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LineReader

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

func NewLineReader

func NewLineReader(src io.ReaderAt) *LineReader

func (*LineReader) LineExists

func (l *LineReader) LineExists(line int64) bool

LineExists returns true if the given line is in the file.

func (*LineReader) Populate

func (l *LineReader) Populate()

Populate scans the file, populating the offsetCache, so that future lookups will be faster.

func (*LineReader) ReadLine

func (l *LineReader) ReadLine(p []byte, line int64) (n int, err error)

ReadLine reads up to len(p) bytes from line number line from the source. It returns the numbers of bytes written and any error encountered. If n < len(p), err is set to a non-nil value explaining why. See io.ReaderAt for full description of return values.

func (*LineReader) SearchLine

func (l *LineReader) SearchLine(r *regexp.Regexp, line int64) ([][]int, error)

SearchLine runs Regexp.FindAllIndex on the given line, providing the same return value.

Jump to

Keyboard shortcuts

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