1 | <?php |
||
29 | class StringReader |
||
30 | { |
||
31 | private $_str; |
||
32 | private $_len; |
||
33 | |||
34 | /** |
||
35 | * Constructor. |
||
36 | * |
||
37 | * @param string $filename Name of file to load |
||
38 | */ |
||
39 | 19 | public function __construct($filename) |
|
44 | |||
45 | /** |
||
46 | * Read number of bytes from given offset. |
||
47 | * |
||
48 | * @param int $pos Offset |
||
49 | * @param int $bytes Number of bytes to read |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | 19 | public function read($pos, $bytes) |
|
61 | |||
62 | /** |
||
63 | * Reads a 32bit integer from the stream. |
||
64 | * |
||
65 | * @param string $unpack Unpack string |
||
66 | * @param int $pos Position |
||
67 | * |
||
68 | * @return int Ingerer from the stream |
||
69 | */ |
||
70 | 17 | public function readint($unpack, $pos) |
|
76 | |||
77 | /** |
||
78 | * Reads an array of integers from the stream. |
||
79 | * |
||
80 | * @param string $unpack Unpack string |
||
81 | * @param int $pos Position |
||
82 | * @param int $count How many elements should be read |
||
83 | * |
||
84 | * @return array Array of Integers |
||
85 | */ |
||
86 | 14 | public function readintarray($unpack, $pos, $count) |
|
90 | } |
||
91 |