bit

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bit

type Bit bool

A Bit is a zero or a one

const (
	// Zero is our exported type for '0' bits
	Zero Bit = false
	// One is our exported type for '1' bits
	One Bit = true
)

type Reader

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

Reader reads bits from buffer

func NewReader

func NewReader(buf *bufioutil.Buffer) *Reader

NewReader crate bit reader

func (*Reader) ReadBit

func (r *Reader) ReadBit() (Bit, error)

ReadBit reads a bit, if failure return error

func (*Reader) ReadBits

func (r *Reader) ReadBits(numBits int) (uint64, error)

ReadBits read number of bits

func (*Reader) ReadByte

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

ReadByte reads a byte

func (*Reader) Reset

func (r *Reader) Reset()

Reset resets the reader to read from a new slice

type Writer

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

Writer writes bits to an io.Writer

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter create bit writer

func (*Writer) Flush

func (w *Writer) Flush() error

Flush flushes the currently in-process byte

func (*Writer) Reset

func (w *Writer) Reset(writer io.Writer)

Reset writes to a new writer

func (*Writer) WriteBit

func (w *Writer) WriteBit(bit Bit) error

WriteBit writes a bit value

func (*Writer) WriteBits

func (w *Writer) WriteBits(u uint64, numBits int) error

WriteBits writes number of bits

func (*Writer) WriteByte

func (w *Writer) WriteByte(b byte) error

WriteByte write a byte

Jump to

Keyboard shortcuts

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