# Reader.class.php

Go to the documentation of this file.

    00001 <?php
    00002 /***************************************************************************
    00003  *   Copyright (C) 2007 by Dmitry A. Lomash                                *
    00004  *                                                                         *
    00005  *   This program is free software; you can redistribute it and/or modify  *
    00006  *   it under the terms of the GNU Lesser General Public License as        *
    00007  *   published by the Free Software Foundation; either version 3 of the    *
    00008  *   License, or (at your option) any later version.                       *
    00009  *                                                                         *
    00010  ***************************************************************************/
    00011
    00015     abstract class Reader
    00016     {
    00017         const BLOCK_SIZE = 16384;
    00018
    00019         abstract public function close();
    00020         abstract public function read($count);
    00021
    00022         public function isEof()
    00023         {
    00024             return false;
    00025         }
    00026
    00027         public function mark()
    00028         {
    00029             throw new IOException('mark() not supported');
    00030         }
    00031
    00032         public function markSupported()
    00033         {
    00034             return false;
    00035         }
    00036
    00037         public function reset()
    00038         {
    00039             throw new IOException('reset() not supported');
    00040         }
    00041
    00042         public function skip($count)
    00043         {
    00044             return mb_strlen($this->read($count));
    00045         }
    00046
    00047         public function available()
    00048         {
    00049             return 0;
    00050         }
    00051
    00052         public function getWhole()
    00053         {
    00054             while (!$this->isEof())
    00055                 $result .= $this->read(self::BLOCK_SIZE);
    00056
    00057             return $result;
    00058         }
    00059     }
    00060 ?>