bit

package
v0.0.0-...-3b4ea22 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bit provides bit-wise IO to an io.Writer and from an io.Reader.

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 implements bit-wise reading from an io.Reader.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new bit Reader that reads bytes from `r`.

func (*Reader) Close

func (r *Reader) Close() error

Close closes the reader. It does not close the underlying reader.

func (*Reader) Read

func (r *Reader) Read(width uint) (uint64, error)

ReadLSB reads up to 16 bits from the underlying reader.

func (*Reader) ReadBytes

func (r *Reader) ReadBytes(n int) ([]byte, error)

ReadBytes read byte slice.

func (*Reader) ReadMSB

func (r *Reader) ReadMSB(width uint) (uint32, error)

ReadMSB read a uint32 in MSB order.

func (*Reader) SetReader

func (r *Reader) SetReader(ior io.Reader)

SetReader set ior to reader of r.

type Writer

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

Writer implements bit-wise writing to an io.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter returns a new bit Writer that writes completed bytes to `w`.

func (*Writer) Close

func (w *Writer) Close() error

Close closes the writer, flushing any pending output. It does not close the underlying writer.

func (*Writer) Write

func (w *Writer) Write(c uint64, width uint) error

Write writes `width` bits of `c` in LSB order.

func (*Writer) WriteBytes

func (w *Writer) WriteBytes(bytes []byte) error

WriteBytes write byte slice

Jump to

Keyboard shortcuts

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