|
static | encode ($data, $params=null) |
|
static | decode ($data, $params=null) |
|
Definition at line 33 of file RunLength.php.
◆ decode()
static decode |
( |
|
$data, |
|
|
|
$params = null |
|
) |
| |
|
static |
Decode data
- Parameters
-
- Returns
- string
- Exceptions
-
Implements Zend_Pdf_Filter_Interface.
Definition at line 95 of file RunLength.php.
97 $dataLength = strlen(
$data);
101 while($offset < $dataLength) {
102 $length = ord(
$data[$offset]);
106 if ($length == 128) {
109 }
else if ($length < 128) {
115 }
else if ($length > 128) {
◆ encode()
static encode |
( |
|
$data, |
|
|
|
$params = null |
|
) |
| |
|
static |
Encode data
- Parameters
-
- Returns
- string
- Exceptions
-
Implements Zend_Pdf_Filter_Interface.
Definition at line 43 of file RunLength.php.
47 $chainStartOffset = 0;
50 while ($offset < strlen(
$data)) {
53 if (($repeatedCharChainLength = strspn(
$data,
$data[$offset], $offset + 1, 127) + 1) > 2) {
54 if ($chainStartOffset != $offset) {
56 $output .= chr($offset - $chainStartOffset - 1)
57 . substr(
$data, $chainStartOffset, $offset - $chainStartOffset);
60 $output .= chr(257 - $repeatedCharChainLength) .
$data[$offset];
62 $offset += $repeatedCharChainLength;
63 $chainStartOffset = $offset;
67 if ($offset - $chainStartOffset == 128) {
70 $output .=
"\x7F" . substr(
$data, $chainStartOffset, 128);
72 $chainStartOffset = $offset;
77 if ($chainStartOffset != $offset) {
79 $output .= chr($offset - $chainStartOffset - 1) . substr(
$data, $chainStartOffset, $offset - $chainStartOffset);
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Pdf/Filter/RunLength.php