\Zxing\CommonBitSource

<p>This provides an easy abstraction to read bits at a time from a sequence of bytes, where the number of bits read is not often a multiple of 8.</p>

This class is thread-safe but not reentrant -- unless the caller modifies the bytes array it passed in, in which case all bets are off.

Summary

Methods
Properties
Constants
__construct()
getBitOffset()
getByteOffset()
readBits()
available()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$byteOffset
$bitOffset
$bytes
N/A

Properties

$byteOffset

$byteOffset : int

Type

int

$bitOffset

$bitOffset : int

Type

int

$bytes

$bytes

Methods

__construct()

__construct(\Zxing\Common\bytes  $bytes) : mixed

Parameters

\Zxing\Common\bytes $bytes

from which this will read bits. Bits will be read from the first byte first. Bits are read within a byte from most-significant to least-significant bit.

Returns

mixed —

getBitOffset()

getBitOffset() : \Zxing\Common\index

Returns

\Zxing\Common\index —

of next bit in current byte which would be read by the next call to {@link #readBits(int)}.

getByteOffset()

getByteOffset() : \Zxing\Common\index

Returns

\Zxing\Common\index —

of next byte in input byte array which would be read by the next call to {@link #readBits(int)}.

readBits()

readBits(\Zxing\Common\number  $numBits) : int

Parameters

\Zxing\Common\number $numBits

of bits to read

Throws

\Zxing\Common\InvalidArgumentException

if numBits isn't in [1,32] or more than is available

Returns

int —

representing the bits read. The bits will appear as the least-significant bits of the int

available()

available() : \Zxing\Common\number

Returns

\Zxing\Common\number —

of bits that can be read successfully