Menu

## BitBuffer
in package

BitBuffer.php : 19

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
rewind() : self
  Resets the read-counters

### Properties

#### $bitsRead

BitBuffer.php : 41

Read count (bits)

`private int $bitsRead = 0`

#### $buffer

BitBuffer.php : 26

The buffer content

`private array<string|int, mixed> $buffer`

#### $bytesRead

BitBuffer.php : 36

Read count (bytes)

`private int $bytesRead = 0`

#### $length

BitBuffer.php : 31

Length of the content (bits)

`private int $length`

### Methods

#### __construct()

BitBuffer.php : 48

BitBuffer constructor.

`public __construct([array<string|int, int>|null $bytes = null ]) : mixed`

##### Parameters

$bytes : array<string|int, int>|null = null

##### Return values

mixed —

#### available()

BitBuffer.php : 101
`public available() : int`

##### Return values

int —

number of bits that can be read successfully

#### clear()

BitBuffer.php : 161

Clears the buffer and resets the stats

`public clear() : self`

##### Return values

self —

#### getBuffer()

BitBuffer.php : 94

returns the buffer content

`public getBuffer() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### getLength()

BitBuffer.php : 87

returns the current buffer length

`public getLength() : int`

##### Return values

int —

#### put()

BitBuffer.php : 56

appends a sequence of bits

`public put(int $bits, int $length) : self`

##### Parameters

$bits : int
$length : int

##### Return values

self —

#### putBit()

BitBuffer.php : 68

appends a single bit

`public putBit(bool $bit) : self`

##### Parameters

$bit : bool

##### Return values

self —

#### read()

BitBuffer.php : 113
`public read(int $numBits) : int`

##### Parameters

$numBits : int

  number of bits to read

##### Tags

author

  Sean Owen, ZXing

throws
  QRCodeException

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

##### Return values

int —

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

#### rewind()

BitBuffer.php : 171

Resets the read-counters

`public rewind() : self`

##### Return values

self —

## Search results