bio

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package bio implements common I/O abstractions used within the Go toolchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	*bufio.Reader
	// contains filtered or unexported fields
}

Reader implements a seekable buffered io.Reader.

func NewReader

func NewReader(f *os.File) *Reader

NewReader returns a Reader from an open file.

func Open

func Open(name string) (*Reader, error)

Open returns a Reader for the file named name.

func (*Reader) Close

func (r *Reader) Close() error

func (*Reader) File

func (r *Reader) File() *os.File

func (*Reader) MustSeek

func (r *Reader) MustSeek(offset int64, whence int) int64

func (*Reader) Offset

func (r *Reader) Offset() int64

func (*Reader) Slice

func (r *Reader) Slice(length uint64) ([]byte, bool, error)

Slice reads the next length bytes of r into a slice.

This slice may be backed by mmap'ed memory. Currently, this memory will never be unmapped. The second result reports whether the backing memory is read-only.

func (*Reader) SliceRO

func (r *Reader) SliceRO(length uint64) []byte

SliceRO returns a slice containing the next length bytes of r backed by a read-only mmap'd data. If the mmap cannot be established (limit exceeded, region too small, etc) a nil slice will be returned. If mmap succeeds, it will never be unmapped.

Jump to

Keyboard shortcuts

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