BitBuffer
in package
Holds the raw binary data
Table of Contents
- $bitsRead : int
- Read count (bits)
- $buffer : array<string|int, mixed>
- The buffer content
- $bytesRead : int
- Read count (bytes)
- $length : int
- Length of the content (bits)
- __construct() : mixed
- BitBuffer constructor.
- available() : int
- clear() : self
- Clears the buffer and resets the stats
- getBuffer() : array<string|int, mixed>
- returns the buffer content
- getLength() : int
- returns the current buffer length
- put() : self
- appends a sequence of bits
- putBit() : self
- appends a single bit
- read() : int
Properties
$bitsRead
Read count (bits)
private
int
$bitsRead
= 0
$buffer
The buffer content
private
array<string|int, mixed>
$buffer
$bytesRead
Read count (bytes)
private
int
$bytesRead
= 0
$length
Length of the content (bits)
private
int
$length
Methods
__construct()
BitBuffer constructor.
public
__construct([array<string|int, int>|null $bytes = null ]) : mixed
Parameters
- $bytes : array<string|int, int>|null = null
Return values
mixed —available()
public
available() : int
Return values
int —number of bits that can be read successfully
clear()
Clears the buffer and resets the stats
public
clear() : self
Return values
self —getBuffer()
returns the buffer content
public
getBuffer() : array<string|int, mixed>
Return values
array<string|int, mixed> —getLength()
returns the current buffer length
public
getLength() : int
Return values
int —put()
appends a sequence of bits
public
put(int $bits, int $length) : self
Parameters
- $bits : int
- $length : int
Return values
self —putBit()
appends a single bit
public
putBit(bool $bit) : self
Parameters
- $bit : bool
Return values
self —read()
public
read(int $numBits) : int
Parameters
- $numBits : int
-
number of bits to read
Tags
Return values
int —representing the bits read. The bits will appear as the least-significant bits of the int