1 |
bareface |
1.1 |
<?php |
2 |
|
|
|
3 |
|
|
require_once("YakkaObject.php"); |
4 |
|
|
|
5 |
|
|
class YakkaFileReader extends YakkaObject { |
6 |
|
|
var $fileHandle; |
7 |
|
|
var $fileData; |
8 |
|
|
|
9 |
|
|
function YakkaFileReader($filename = null) { |
10 |
|
|
$this->YakkaObject("YakkaFileReader"); |
11 |
|
|
|
12 |
|
|
$this->fileHandle = $filename ? $this->open($filename) : null; |
13 |
|
|
$this->fileData = null; |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
function open($filename) { |
17 |
|
|
return $this->fileHandle = file_exists($filename) ? fopen($filename, "r") : null; |
18 |
|
|
} |
19 |
|
|
|
20 |
|
|
function close() { |
21 |
|
|
return $this->fileHandle ? fclose($this->fileHandle) : null; |
22 |
|
|
} |
23 |
|
|
|
24 |
|
|
function readAll() { |
25 |
|
|
while ($buffer = fread($this->fileHandle, 4096)) |
26 |
|
|
$this->fileData .= $buffer; |
27 |
|
|
|
28 |
|
|
return $this->fileData; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
|
function isOpen() { |
32 |
|
|
return $this->fileHandle ? true : false; |
33 |
|
|
} |
34 |
|
|
} |
35 |
|
|
|
36 |
|
|
?> |