InputStream.class.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************************
00003  *   Copyright (C) 2007 by Ivan Y. Khvostishkov                            *
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 InputStream
00016     {
00032         abstract public function read($length);
00033         abstract public function isEof();
00034         
00038         public function mark()
00039         {
00040             /* nop */
00041             
00042             return $this;
00043         }
00044         
00045         public function markSupported()
00046         {
00047             return false;
00048         }
00049         
00050         public function reset()
00051         {
00052             throw new IOException(
00053                 'mark has been invalidated'
00054             );
00055         }
00056         
00057         public function skip($count)
00058         {
00059             return strlen($this->read($count));
00060         }
00061         
00062         public function available()
00063         {
00064             return 0;
00065         }
00066         
00070         public function close()
00071         {
00072             /* nop */
00073             
00074             return $this;
00075         }
00076     }
00077 ?>