rawreader

package module
v0.0.0-...-56820a9 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 4 Imported by: 15

README

rawreader

Implements io.ReaderAt over raw memory.

You should REFLECT on how UNSAFE this is.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RawReader

type RawReader struct {
	Data   []byte
	Length int
	// contains filtered or unexported fields
}

RawReader implements interfaces implemented by files over raw memory

this is completely unsafe by design
you should either know why you want this exactly or stay away!

func New

func New(start uintptr, length int) *RawReader

New returns a new populated RawReader

func (*RawReader) ReadAt

func (f *RawReader) ReadAt(p []byte, off int64) (n int, err error)

ReadAt implements io.ReaderAt https://golang.org/pkg/io/#ReaderAt ReadAt reads len(p) bytes into p starting at offset off in the underlying input source. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.

When ReadAt returns n < len(p), it returns a non-nil error explaining why more bytes were not returned. In this respect, ReadAt is stricter than Read.

Even if ReadAt returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, ReadAt blocks until either all the data is available or an error occurs. In this respect ReadAt is different from Read.

If the n = len(p) bytes returned by ReadAt are at the end of the input source, ReadAt may return either err == EOF or err == nil.

If ReadAt is reading from an input source with a seek offset, ReadAt should not affect nor be affected by the underlying seek offset. Clients of ReadAt can execute parallel ReadAt calls on the same input source.

Jump to

Keyboard shortcuts

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