bitstream

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DebugInputBitStream

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

DebugInputBitStream is an implementation of InputBitStream used for debugging.

func NewDebugInputBitStream

func NewDebugInputBitStream(ibs kanzi.InputBitStream, writer io.Writer) (*DebugInputBitStream, error)

NewDebugInputBitStream creates a DebugInputBitStream wrapped around 'ibs'. All calls are delegated to the 'ibs' InputBitStream and read bits are logged to the provided io.Writer.

func (*DebugInputBitStream) Close

func (this *DebugInputBitStream) Close() (bool, error)

Close makes the bitstream unavailable for further reads. Calls Close() on the underlying bitstream delegate.

func (*DebugInputBitStream) HasMoreToRead

func (this *DebugInputBitStream) HasMoreToRead() (bool, error)

HasMoreToRead returns false when the bitstream is closed or the EOS has been reached Calls HasMoreToRead() on the underlying bitstream delegate.

func (*DebugInputBitStream) Mark

func (this *DebugInputBitStream) Mark(mark bool)

Mark sets the internal mark state. When true. displays 'r' after each bit or bit sequence read from the bitstream delegate.

func (*DebugInputBitStream) Read

func (this *DebugInputBitStream) Read() uint64

Read returns the number of bits read Calls Read() on the underlying bitstream delegate.

func (*DebugInputBitStream) ReadArray

func (this *DebugInputBitStream) ReadArray(bits []byte, count uint) uint

ReadArray reads 'length' bits from the bitstream and put them in the byte slice. Returns the number of bits read. Panics if closed or EOS is reached. Calls ReadArray() on the underlying bitstream delegate.

func (*DebugInputBitStream) ReadBit

func (this *DebugInputBitStream) ReadBit() int

ReadBit returns the next bit in the bitstream. Panics if closed or EOS is reached. Calls ReadBit() on the underlying bitstream delegate.

func (*DebugInputBitStream) ReadBits

func (this *DebugInputBitStream) ReadBits(length uint) uint64

ReadBits reads 'length' (in [1..64]) bits from the bitstream . Returns the bits read as an uint64. Panics if closed or EOS is reached. Calls ReadBits() on the underlying bitstream delegate.

func (*DebugInputBitStream) ShowByte

func (this *DebugInputBitStream) ShowByte(show bool)

ShowByte sets the internal show byte state. When true, displays the hexadecimal value after the bits.

type DebugOutputBitStream

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

DebugOutputBitStream is an implementation of OutputBitStream used for debugging.

func NewDebugOutputBitStream

func NewDebugOutputBitStream(obs kanzi.OutputBitStream, writer io.Writer) (*DebugOutputBitStream, error)

NewDebugOutputBitStream creates a DebugOutputBitStream wrapped around 'obs'. All calls are delegated to the 'obs' OutputBitStream and written bits are logged to the provided io.Writer.

func (*DebugOutputBitStream) Close

func (this *DebugOutputBitStream) Close() (bool, error)

Close makes the bitstream unavailable for further writes. Calls Close() on the underlying bitstream delegate.

func (*DebugOutputBitStream) Mark

func (this *DebugOutputBitStream) Mark(mark bool)

Mark sets the internal mark state. When true. displays 'w' after each bit or bit sequence read from the bitstream delegate.

func (*DebugOutputBitStream) ShowByte

func (this *DebugOutputBitStream) ShowByte(show bool)

ShowByte sets the internal show byte state. When true, displays the hexadecimal value after the bits.

func (*DebugOutputBitStream) WriteArray

func (this *DebugOutputBitStream) WriteArray(bits []byte, count uint) uint

WriteArray writes bits out of the byte slice. Length is the number of bits. Returns the number of bits written. Panics if closed or an IO error is received. Calls WriteArray() on the underlying bitstream delegate.

func (*DebugOutputBitStream) WriteBit

func (this *DebugOutputBitStream) WriteBit(bit int)

WriteBit writes the least significant bit of the input integer Panics if closed or an IO error is received. Calls WriteBit() on the underlying bitstream delegate.

func (*DebugOutputBitStream) WriteBits

func (this *DebugOutputBitStream) WriteBits(bits uint64, length uint) uint

WriteBits writes the least significant bits of 'bits' to the bitstream. Length is the number of bits to write (in [1..64]). Returns the number of bits written. Panics if closed or an IO error is received. Calls WriteBits() on the underlying bitstream delegate.

func (*DebugOutputBitStream) Written

func (this *DebugOutputBitStream) Written() uint64

Written returns the number of bits written Calls Written() on the underlying bitstream delegate.

type DefaultInputBitStream

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

DefaultInputBitStream is the default implementation of InputBitStream

func NewDefaultInputBitStream

func NewDefaultInputBitStream(stream io.ReadCloser, bufferSize uint) (*DefaultInputBitStream, error)

NewDefaultInputBitStream creates a bitstream for reading, using the provided stream as the underlying I/O object.

func (*DefaultInputBitStream) Close

func (this *DefaultInputBitStream) Close() (bool, error)

Close prevents further reads (beyond the available bits)

func (*DefaultInputBitStream) Closed

func (this *DefaultInputBitStream) Closed() bool

Closed says whether this stream can be read from

func (*DefaultInputBitStream) HasMoreToRead

func (this *DefaultInputBitStream) HasMoreToRead() (bool, error)

HasMoreToRead returns false is the stream is closed or there is no more bit to read.

func (*DefaultInputBitStream) Read

func (this *DefaultInputBitStream) Read() uint64

Read returns the number of bits read so far

func (*DefaultInputBitStream) ReadArray

func (this *DefaultInputBitStream) ReadArray(bits []byte, count uint) uint

ReadArray reads 'count' bits from the stream and returns them to the 'bits' slice. It panics if the stream is closed or the number of bits to read exceeds the length of the 'bits' slice. Returns the number of bits read.

func (*DefaultInputBitStream) ReadBit

func (this *DefaultInputBitStream) ReadBit() int

ReadBit returns the next bit

func (*DefaultInputBitStream) ReadBits

func (this *DefaultInputBitStream) ReadBits(count uint) uint64

ReadBits reads 'count' bits from the stream and returns them as an uint64. It panics if the count is outside of the [1..64] range or the stream is closed. Returns the number of bits read.

type DefaultOutputBitStream

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

DefaultOutputBitStream is the default implementation of OutputBitStream

func NewDefaultOutputBitStream

func NewDefaultOutputBitStream(stream io.WriteCloser, bufferSize uint) (*DefaultOutputBitStream, error)

NewDefaultOutputBitStream creates a bitstream for writing, using the provided stream as the underlying I/O object.

func (*DefaultOutputBitStream) Close

func (this *DefaultOutputBitStream) Close() (bool, error)

Close prevents further writes

func (*DefaultOutputBitStream) Closed

func (this *DefaultOutputBitStream) Closed() bool

Closed says whether this stream can be written to

func (*DefaultOutputBitStream) WriteArray

func (this *DefaultOutputBitStream) WriteArray(bits []byte, count uint) uint

WriteArray writes 'count' bits from 'bits' to the bitstream. Panics if the bitstream is closed or 'count' bigger than the number of bits in the 'bits' slice. Returns the number of written bits.

func (*DefaultOutputBitStream) WriteBit

func (this *DefaultOutputBitStream) WriteBit(bit int)

WriteBit writes the least significant bit of the input integer. Panics if the bitstream is closed

func (*DefaultOutputBitStream) WriteBits

func (this *DefaultOutputBitStream) WriteBits(value uint64, count uint) uint

WriteBits writes 'count' from 'value' to the bitstream. Panics if the bitstream is closed or 'count' is outside of [1..64]. Returns the number of written bits.

func (*DefaultOutputBitStream) Written

func (this *DefaultOutputBitStream) Written() uint64

Written returns the number of bits written so far

Jump to

Keyboard shortcuts

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