bit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

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 bits from buffer

func NewReader

func NewReader(in io.ByteReader) *Reader

NewReader crate bit reader

func (*Reader) ReadBits

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

ReadBits read number of bits

func (*Reader) ReadBool

func (r *Reader) ReadBool() (bool, error)

ReadBool reads a bit, 1 returns true, 0 returns false

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.BufferWriter

func NewWriter

func NewWriter(buffer *bytes.Buffer) *Writer

NewWriter create bit writer

func (*Writer) Flush

func (w *Writer) Flush()

Flush flushes the currently in-process byte

func (*Writer) Reset

func (w *Writer) Reset(buffer *bytes.Buffer)

Reset writes to a new writer

func (*Writer) WriteBits

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

WriteBits writes number of bits

func (*Writer) WriteBool

func (w *Writer) WriteBool(b bool)

WriteBool writes a boolean value true: 1 false: 0

func (*Writer) WriteByte

func (w *Writer) WriteByte(b byte)

WriteByte write a byte

Jump to

Keyboard shortcuts

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