| @@ 478-486 (lines=9) @@ | ||
| 475 | * @param integer $o Offset |
|
| 476 | * @return string|false |
|
| 477 | */ |
|
| 478 | public function lookExact($n, $o = 0) |
|
| 479 | { |
|
| 480 | if (!isset($this->bev)) { |
|
| 481 | return false; |
|
| 482 | } |
|
| 483 | if ($o + $n > $this->bev->input->length) { |
|
| 484 | return false; |
|
| 485 | } |
|
| 486 | return $this->bev->input->substr($o, $n); |
|
| 487 | } |
|
| 488 | ||
| 489 | /** |
|
| @@ 521-529 (lines=9) @@ | ||
| 518 | * @param integer $o Offset |
|
| 519 | * @return string|false |
|
| 520 | */ |
|
| 521 | public function look($n, $o = 0) |
|
| 522 | { |
|
| 523 | if (!isset($this->bev)) { |
|
| 524 | return false; |
|
| 525 | } |
|
| 526 | if ($this->bev->input->length <= $o) { |
|
| 527 | return ''; |
|
| 528 | } |
|
| 529 | return $this->bev->input->substr($o, $n); |
|
| 530 | } |
|
| 531 | ||
| 532 | /** |
|
| @@ 563-572 (lines=10) @@ | ||
| 560 | * @param integer $n Number of bytes to read |
|
| 561 | * @return string|false |
|
| 562 | */ |
|
| 563 | public function readExact($n) |
|
| 564 | { |
|
| 565 | if ($n === 0) { |
|
| 566 | return ''; |
|
| 567 | } |
|
| 568 | if (!$this->bev || $this->bev->input->length < $n) { |
|
| 569 | return false; |
|
| 570 | } |
|
| 571 | return $this->read($n); |
|
| 572 | } |
|
| 573 | ||
| 574 | /** |
|
| 575 | * Returns length of input buffer |
|
| @@ 960-969 (lines=10) @@ | ||
| 957 | * Reads all data from the connection's buffer |
|
| 958 | * @return string Readed data |
|
| 959 | */ |
|
| 960 | public function readUnlimited() |
|
| 961 | { |
|
| 962 | if (!isset($this->bev)) { |
|
| 963 | return false; |
|
| 964 | } |
|
| 965 | $read = $this->bev->read($this->bev->input->length); |
|
| 966 | if ($read === null) { |
|
| 967 | return false; |
|
| 968 | } |
|
| 969 | return $read; |
|
| 970 | } |
|
| 971 | } |
|
| 972 | ||