bits

package
v0.0.0-...-ecf7a0d Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package bits provides access to read and write values bit-by-bit.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer wraps an io.Writer and provides the ability to write values bit-by-bit to it. It's Write* methods don't return the usual error because error handling is verbose. Instead, any error is kept and can be checked afterwards.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter creates a bit writer writing to w.

func (Writer) Buffered

func (w Writer) Buffered() uint

Buffered gets the number of buffered bits.

func (Writer) Err

func (w Writer) Err() error

Err gets the error for the bit writer.

func (*Writer) WriteBits

func (w *Writer) WriteBits(n uint, bits uint64)

WriteBits writes n bits to the writer, if n is less than a byte buffering may occur until enough bits are given to write.

Jump to

Keyboard shortcuts

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