| 1 | <?php |
||
| 10 | class StringReader extends Reader |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The raw string of bytes. |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $string; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * The current position in the string. |
||
| 21 | * |
||
| 22 | * @var int |
||
| 23 | */ |
||
| 24 | protected $position; |
||
| 25 | |||
| 26 | /** |
||
| 27 | * The string length. |
||
| 28 | * |
||
| 29 | * @var int |
||
| 30 | */ |
||
| 31 | protected $length; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Initializes the instance. |
||
| 35 | * |
||
| 36 | * @param string $string The raw string containing the data to be read. |
||
| 37 | */ |
||
| 38 | 26 | public function __construct($string) |
|
| 44 | |||
| 45 | /** |
||
| 46 | * {@inheritdoc} |
||
| 47 | * |
||
| 48 | * @see \CHMLib\Reader\Reader::setPosition() |
||
| 49 | */ |
||
| 50 | public function setPosition($position) |
||
| 57 | |||
| 58 | /** |
||
| 59 | * {@inheritdoc} |
||
| 60 | * |
||
| 61 | * @see \CHMLib\Reader\Reader::getPosition() |
||
| 62 | */ |
||
| 63 | public function getPosition() |
||
| 67 | |||
| 68 | /** |
||
| 69 | * {@inheritdoc} |
||
| 70 | * |
||
| 71 | * @see \CHMLib\Reader\Reader::getLength() |
||
| 72 | */ |
||
| 73 | public function getLength() |
||
| 77 | |||
| 78 | /** |
||
| 79 | * {@inheritdoc} |
||
| 80 | * |
||
| 81 | * @see \CHMLib\Reader\Reader::readString() |
||
| 82 | */ |
||
| 83 | 26 | public function readString($length) |
|
| 96 | } |
||
| 97 |