CDB reader class.
More...
|
| __construct (string $fileName) |
|
| close () |
| Close the handle on the CDB file.
|
|
| get ( $key) |
| Get the value of a key.
|
|
| exists ( $key) |
| Check if a key exists in the CDB file.
|
|
| firstkey () |
| Get the first key from the CDB file and reset the key iterator.
|
|
| nextkey () |
| Get the next key from the CDB file.
|
|
|
| read ( $start, $len) |
| Read data from the CDB file.
|
|
| readInt31 ( $pos=0) |
| Unpack an unsigned integer and throw an exception if it needs more than 31 bits.
|
|
| readInt32 ( $pos=0) |
| Unpack a 32-bit integer.
|
|
| find ( $key) |
| Search the CDB file for a key.
|
|
|
| $fileName |
|
| $handle |
| The file handle.
|
|
| $index |
|
| $dataPos |
|
| $dataLen |
|
| $keyIterPos = 2048 |
|
| $keyIterStop |
|
| $buf |
|
| $bufStart |
|
| $filePos = 2048 |
|
|
static | open ( $fileName) |
| Open a file and return a subclass instance.
|
|
static | haveExtension () |
| Returns true if the native extension is available.
|
|
CDB reader class.
This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that appears in PHP 5.3.
◆ __construct()
Cdb\Reader\PHP::__construct |
( |
string | $fileName | ) |
|
- Parameters
-
- Exceptions
-
Exception | If CDB file cannot be opened or if it contains fewer than 2048 bytes of data. |
◆ close()
Cdb\Reader\PHP::close |
( |
| ) |
|
Close the handle on the CDB file.
Reimplemented from Cdb\Reader.
◆ exists()
Cdb\Reader\PHP::exists |
( |
| $key | ) |
|
Check if a key exists in the CDB file.
- Parameters
-
- Returns
- bool Whether the key exists.
Reimplemented from Cdb\Reader.
◆ find()
Cdb\Reader\PHP::find |
( |
| $key | ) |
|
|
protected |
Search the CDB file for a key.
Sets dataLen
and dataPos
properties if successful.
- Parameters
-
- Returns
- bool Whether the key was found.
◆ firstkey()
Cdb\Reader\PHP::firstkey |
( |
| ) |
|
Get the first key from the CDB file and reset the key iterator.
- Returns
- string|bool Key, or false if no keys in file.
Reimplemented from Cdb\Reader.
◆ get()
Cdb\Reader\PHP::get |
( |
| $key | ) |
|
Get the value of a key.
- Parameters
-
- Returns
- string|false The key's value or false if not found
Reimplemented from Cdb\Reader.
◆ nextkey()
Cdb\Reader\PHP::nextkey |
( |
| ) |
|
Get the next key from the CDB file.
- Returns
- string|bool Key, or false if no more keys.
Reimplemented from Cdb\Reader.
◆ read()
Cdb\Reader\PHP::read |
( |
| $start, |
|
|
| $len ) |
|
protected |
Read data from the CDB file.
- Parameters
-
int | $start | Start reading from this position |
int | $len | Number of bytes to read |
- Returns
- string Read data.
◆ readInt31()
Cdb\Reader\PHP::readInt31 |
( |
| $pos = 0 | ) |
|
|
protected |
Unpack an unsigned integer and throw an exception if it needs more than 31 bits.
- Parameters
-
int | $pos | Position to read from. |
- Exceptions
-
Exception | When the integer cannot be represented in 31 bits. |
- Returns
- int
◆ readInt32()
Cdb\Reader\PHP::readInt32 |
( |
| $pos = 0 | ) |
|
|
protected |
Unpack a 32-bit integer.
- Parameters
-
- Returns
- int
The documentation for this class was generated from the following file: