reader

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitReader

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

BitReader wraps an io.Reader and provides the ability to read values, bit-by-bit, from it.

func New

func New(dataReader io.Reader, dataLength int) (*BitReader, error)

New creates a BitReader from an io.reader. It reads 'dataLength' bytes and stores them in an internal buffer.

func (*BitReader) ReadInt

func (r *BitReader) ReadInt(bits int) (int64, error)

ReadInt reads an integer encoded on `bits' bits. for instance, given:

  • the following stream: A8 E5 2B
  • ReadInt(10)

10101000 11100101 00101011 \------- -/ 1010100011 -> -163 * First bit indicates a negative number * 010100011 means 163

func (*BitReader) ReadUintsBlock

func (r *BitReader) ReadUintsBlock(bits int, count int64, resetOffset bool) ([]uint64, error)

ReadUintsBlock reads a set of unsigned integer encoded on `bits' bits.

func (*BitReader) ResetOffset

func (r *BitReader) ResetOffset()

ResetOffset reset the bit cursor to 0. The bit cursor is a value between 0 and 7 that point on the current bit to be read.

Jump to

Keyboard shortcuts

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