bytesextra

package module
v0.0.0-...-846e454 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2022 License: CC0-1.0 Imports: 4 Imported by: 7

README

GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsZeroFilled

func IsZeroFilled(b []byte) bool

IsZeroFilled returns true if b consists of zeros only.

Types

type ReadWriteSeeker

type ReadWriteSeeker struct {
	Storage         []byte
	CurrentPosition uint
}

ReadWriteSeeker is a wrapper for a []byte slice which implements io.ReadWrite.Seeker.

func NewReadWriteSeeker

func NewReadWriteSeeker(storage []byte) *ReadWriteSeeker

NewReadWriteSeeker wraps `storage` with an implementation of io.ReadWriteSeeker.

func (*ReadWriteSeeker) Read

func (w *ReadWriteSeeker) Read(b []byte) (n int, err error)

Read implements io.Reader.

Read reads `Storage` into `b`.

If nothing else left to read then io.EOF is returned as `err`.

func (*ReadWriteSeeker) Seek

func (w *ReadWriteSeeker) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker.

func (*ReadWriteSeeker) Write

func (w *ReadWriteSeeker) Write(b []byte) (n int, err error)

Write implements io.Writer

Write writes `b` into the `Storage`.

If the `Storage` is full then returns io.EOF as `err`. On partial write returns `io.ErrShortWrite` as `err`.

Jump to

Keyboard shortcuts

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