예제 #1
0
파일: Base.php 프로젝트: shabbyrobe/defile
 public function read($length = null)
 {
     if (!($this->mode & Stream::READ)) {
         throw FileException::ENOTREADABLE();
     }
     list($buf, $bytesRead) = $this->doRead($length);
     if ($length === null || $bytesRead != $length) {
         $this->eof = true;
     }
     return $buf;
 }
예제 #2
0
 function read($length = null)
 {
     if (!($this->streamMode & Stream::READ)) {
         throw FileException::ENOTREADABLE();
     }
     if ($length === null) {
         $buf = stream_get_contents($this->handle);
     } else {
         $buf = fread($this->handle, $length);
     }
     return $buf;
 }