bitio

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAlignment  = errors.New("invalid alignment")
	ErrDiscouragedReader = errors.New("discouraged reader implementation")
)

Functions

This section is empty.

Types

type ReadSeeker

type ReadSeeker interface {
	Reader
	io.Seeker
}

func NewReadSeeker

func NewReadSeeker(r io.ReadSeeker) ReadSeeker

type Reader

type Reader interface {
	io.Reader

	// alignment:
	//  |-1-byte-block-|--------------|--------------|--------------|
	//  |<-offset->|<-------------------width---------------------->|
	ReadBits(width uint) (data []byte, err error)

	ReadBit() (bit bool, err error)
}

func NewReader

func NewReader(r io.Reader) Reader

type Writer

type Writer interface {
	io.Writer

	// alignment:
	//  |-1-byte-block-|--------------|--------------|--------------|
	//  |<-offset->|<-------------------width---------------------->|
	WriteBits(data []byte, width uint) error

	WriteBit(bit bool) error
}

func NewWriter

func NewWriter(w io.Writer) Writer

Jump to

Keyboard shortcuts

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