buffbits

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: MIT Imports: 2 Imported by: 0

README

buffbits

License Go Reference Lint/Test

buffbits provides a buffered reader/writer that exposes bit level io access.

Install

go get github.com/larzconwell/buffbits

Documentation

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 implements buffered bit level write access to an underlying io.Writer. Buffered writing is powered by the bufio package. If an error occurs while writing to a Writer, no more data will be written and all subsequent calls will return an error. After all data has been written, the client should call Flush to guarantee all the data has been written to the underlying io.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter creates a buffered bit writer writing to w.

func NewWriterSize

func NewWriterSize(w io.Writer, size int) *Writer

NewWriterSize creates a buffered bit writer writing to w using a buffer of size bytes.

func (*Writer) Err

func (w *Writer) Err() error

Err returns the first error that was encountered by the Writer.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush writes all the buffered data and pads to the last byte with 0s.

func (*Writer) Write

func (w *Writer) Write(value uint64, count int) error

Write writes the lowest count bits of value to the buffer.

Jump to

Keyboard shortcuts

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