bitreader

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrExpGolombDecode represents an error in decoding a number represented in exponential-golomb coding
	ErrExpGolombDecode = errors.New("could not complete Exp-Golomb decode")
	// ErrReaderOutOfBounds is returned if an attempt is made to read from a parser that has been depleted
	ErrReaderOutOfBounds = errors.New("cannot read past end of reader bytes")
)

Functions

This section is empty.

Types

type BitReader

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

func NewBitReader

func NewBitReader(input []byte) *BitReader

func (*BitReader) BitsLeft

func (p *BitReader) BitsLeft() uint

Return the total number of bits left in the stream

func (*BitReader) ByteAlign

func (p *BitReader) ByteAlign()

Pefrom byte alignment (skip any remaining bits of current byte)

func (*BitReader) ByteOffset

func (p *BitReader) ByteOffset() uint64

func (*BitReader) BytesLeft

func (p *BitReader) BytesLeft() uint

Return the number of bytes left (even if partially read)

func (*BitReader) HasBitLeft

func (p *BitReader) HasBitLeft() bool

Return if there's a bit left in the stream

func (*BitReader) HasByteLeft

func (p *BitReader) HasByteLeft() bool

Return if there is a byte left in the stream

func (*BitReader) HasBytesLeft

func (p *BitReader) HasBytesLeft(n uint) bool

Return if there are n bytes left in the stream

func (*BitReader) PeekBit

func (p *BitReader) PeekBit() (byte, error)

Return the next bit from the buffer, do not adv. the cursor

func (*BitReader) PeekBits

func (p *BitReader) PeekBits(n uint) (uint, error)

Return n number of bits from the buffer, do not adv. the cursor

func (*BitReader) ReadBit

func (p *BitReader) ReadBit() (byte, error)

Return the next bit from the buffer

func (*BitReader) ReadBitAsBool

func (p *BitReader) ReadBitAsBool() (bool, error)

func (*BitReader) ReadBits

func (p *BitReader) ReadBits(n uint) (byte, error)

Return n number of bits

func (*BitReader) ReadBitsAsInt

func (p *BitReader) ReadBitsAsInt(n uint) (int, error)

Return the number of bits as a signed integer

func (*BitReader) ReadBitsAsUInt

func (p *BitReader) ReadBitsAsUInt(n uint) (uint, error)

Return the number of bits as an unsigned integer

func (*BitReader) ReadBitsAsUInt16

func (p *BitReader) ReadBitsAsUInt16(n uint) (uint16, error)

Return the number of bits as an unsigned integer

func (*BitReader) ReadBitsAsUInt32

func (p *BitReader) ReadBitsAsUInt32(n uint) (uint32, error)

Return the number of bits as an unsigned integer

func (*BitReader) ReadBitsAsUInt8

func (p *BitReader) ReadBitsAsUInt8(n uint) (uint8, error)

Return the number of bits as an unsigned integer

func (*BitReader) ReadBitsToByteArray

func (p *BitReader) ReadBitsToByteArray(n uint) ([]byte, error)

Return n number of bits into a byte array

func (*BitReader) ReadBytes

func (p *BitReader) ReadBytes(n uint) ([]byte, error)

Return n number of bytes read from the buffer

func (*BitReader) ReadSE

func (p *BitReader) ReadSE() (int32, error)

Read Signed Exp-Golomb

func (*BitReader) ReadUE

func (p *BitReader) ReadUE() (uint32, error)

Read Unsigned Exp-Golomb

func (*BitReader) Reset

func (p *BitReader) Reset()

Reset the stream reader back to the start of the buffer

func (*BitReader) SkipBits

func (p *BitReader) SkipBits(n uint) error

Skip n number of bits in the buffer

func (*BitReader) SkipBytes

func (p *BitReader) SkipBytes(n uint) error

Skip n number of bytes in the buffer

Jump to

Keyboard shortcuts

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