| 1 | <?php |
||
| 8 | class Writer |
||
| 9 | { |
||
| 10 | /** @var null|resource */ |
||
| 11 | protected $fd = null; |
||
| 12 | /** @var string */ |
||
| 13 | protected $buffer = ''; |
||
| 14 | /** @var int */ |
||
| 15 | protected $bufferSize; |
||
| 16 | /** @var bool */ |
||
| 17 | protected $check_utf8 = false; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * Writer constructor. |
||
| 21 | * |
||
| 22 | * @param string $filename |
||
| 23 | * @param string $openFlags |
||
| 24 | * @param int $bufferSize |
||
| 25 | * |
||
| 26 | * @throws \Exception |
||
| 27 | */ |
||
| 28 | public function __construct($filename, $openFlags = 'w', $bufferSize = 8191) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param $string |
||
| 40 | */ |
||
| 41 | public function write($string) |
||
| 48 | |||
| 49 | /** |
||
| 50 | * add to file |
||
| 51 | */ |
||
| 52 | protected function purge() |
||
| 59 | |||
| 60 | /** |
||
| 61 | * close writing |
||
| 62 | */ |
||
| 63 | public function close() |
||
| 71 | |||
| 72 | /** |
||
| 73 | * close after end |
||
| 74 | */ |
||
| 75 | public function __destruct() |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return int |
||
| 82 | */ |
||
| 83 | public function fTell() |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @param $pos |
||
| 96 | * |
||
| 97 | * @return int |
||
| 98 | */ |
||
| 99 | public function fSeek($pos) |
||
| 109 | } |
||
| 110 |