1 | <?php |
||
5 | class StringReader |
||
6 | { |
||
7 | public $pos; |
||
8 | public $str; |
||
9 | public $strlen; |
||
10 | |||
11 | /** |
||
12 | * Constructor. |
||
13 | * |
||
14 | * @param string $str The string to read |
||
15 | */ |
||
16 | public function __construct($str) |
||
21 | |||
22 | /** |
||
23 | * Read and returns a part of the string. |
||
24 | * |
||
25 | * @param int $bytes The number of bytes to read |
||
26 | * |
||
27 | * @return string |
||
28 | */ |
||
29 | public function read($bytes) |
||
37 | |||
38 | /** |
||
39 | * Move the cursor to a specific position. |
||
40 | * |
||
41 | * @param int $pos The amount of bytes to move |
||
42 | * |
||
43 | * @return int The new position |
||
44 | */ |
||
45 | public function seekto($pos) |
||
51 | } |
||
52 |