filebuf

package
v0.0.0-...-c8b2ac6 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package filebuf implements io.SeekReader for os files. This is useful only for very large files with lots of seeking. (otherwise use ioutil.ReadFile or bufio)

Index

Constants

View Source
const Buflen = 1 << 20

Buflen is the size of the internal buffer. The code is designed to never need to reread unnecessarily

Variables

This section is empty.

Functions

This section is empty.

Types

type Buf

type Buf interface {
	io.ReadCloser
	io.Seeker
	Size() int64
	Stats() Stat
}

Buf is the implemented interface

func FromReader

func FromReader(rd io.Reader) (Buf, error)

FromReader creates a Buf by copying the contents of an io.Reader

func New

func New(fname string) (Buf, error)

New returns an initialized *fbuf or an error

type Stat

type Stat struct {
	Seeks int
	Reads int
	Bytes int64
}

Stat returns the number of underlying seeks and reads, and bytes read

Jump to

Keyboard shortcuts

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