public function stream_eof()
 {
     return $this->stream->eof();
 }
Exemple #2
0
 /**
  * Read a line from the stream up to the maximum allowed buffer length
  *
  * @param puzzle_stream_StreamInterface $stream    Stream to read from
  * @param int                           $maxLength Maximum buffer length
  *
  * @return string|bool
  */
 public static function readline(puzzle_stream_StreamInterface $stream, $maxLength = null)
 {
     $buffer = '';
     $size = 0;
     while (!$stream->eof()) {
         if (false === ($byte = $stream->read(1))) {
             return $buffer;
         }
         $buffer .= $byte;
         // Break when a new line is found or the max length - 1 is reached
         if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
             break;
         }
     }
     return $buffer;
 }
 /**
  * {@inheritdoc}
  */
 public function eof()
 {
     return $this->_delegate->eof();
 }