mmap

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package mmap provides a way to memory-map a file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader reads a memory-mapped file.

Like any io.ReaderAt, clients can execute parallel ReadAt calls, but it is not safe to call Close and reading methods concurrently.

func Open

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

Open memory-maps the named file for reading.

func (*Reader) At

func (r *Reader) At(i int) byte

At returns the byte at index i.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader.

func (*Reader) Len

func (r *Reader) Len() int

Len returns the length of the underlying memory-mapped file.

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

func (*Reader) ReadAt

func (r *Reader) ReadAt(p []byte, off int64) (int, error)

ReadAt implements the io.ReaderAt interface.

func (*Reader) ReadByte

func (r *Reader) ReadByte() (byte, error)

func (*Reader) Seek

func (r *Reader) Seek(offset int64, whence int) (int64, error)

Jump to

Keyboard shortcuts

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