1 | <?php |
||
10 | class FileReader extends Reader |
||
11 | { |
||
12 | /** |
||
13 | * The file name. |
||
14 | * |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $filename; |
||
18 | |||
19 | /** |
||
20 | * The file size. |
||
21 | * |
||
22 | * @var int |
||
23 | */ |
||
24 | protected $length; |
||
25 | |||
26 | /** |
||
27 | * The open file descriptor. |
||
28 | * |
||
29 | * @var resource |
||
30 | */ |
||
31 | protected $fd; |
||
32 | |||
33 | /** |
||
34 | * Initializes the instance. |
||
35 | * |
||
36 | * @param string $filename The file name to be read. |
||
37 | * |
||
38 | * @throws \Exception Throws an Exception in case of errors. |
||
39 | */ |
||
40 | 4 | public function __construct($filename) |
|
59 | |||
60 | /** |
||
61 | * Destruct the instance. |
||
62 | */ |
||
63 | public function __destruct() |
||
70 | |||
71 | /** |
||
72 | * Get the file name. |
||
73 | * |
||
74 | * @return string |
||
75 | */ |
||
76 | public function getFilename() |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | * |
||
84 | * @see \CHMLib\Reader\Reader::setPosition() |
||
85 | */ |
||
86 | 29 | public function setPosition($position) |
|
92 | |||
93 | /** |
||
94 | * {@inheritdoc} |
||
95 | * |
||
96 | * @see \CHMLib\Reader\Reader::getPosition() |
||
97 | */ |
||
98 | 4 | public function getPosition() |
|
107 | |||
108 | /** |
||
109 | * {@inheritdoc} |
||
110 | * |
||
111 | * @see \CHMLib\Reader\Reader::getLength() |
||
112 | */ |
||
113 | 4 | public function getLength() |
|
117 | |||
118 | /** |
||
119 | * {@inheritdoc} |
||
120 | * |
||
121 | * @see \CHMLib\Reader\Reader::readString() |
||
122 | */ |
||
123 | 29 | public function readString($length) |
|
136 | } |
||
137 |
If you suppress an error, we recommend checking for the error condition explicitly: