lineio

package
v6.0.0+incompatible 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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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