/**
  * Reads stream contents
  *
  * @param   io.streams.InputStream is
  * @return  string bytes
  */
 protected function readAll(InputStream $is)
 {
     for ($contents = ''; $is->available();) {
         $contents .= $is->read();
     }
     $is->close();
     return $contents;
 }
Ejemplo n.º 2
0
 /**
  * Read a line
  *
  * @param   io.streams.InputStream in
  * @return  string
  * @throws  lang.FormatException if no line can be read
  */
 protected function readLine(InputStream $in)
 {
     $line = '';
     while ("\n" !== ($chr = $in->read(1))) {
         $line .= $chr;
         if (!$in->available()) {
             break;
         }
     }
     return $line;
 }
Ejemplo n.º 3
0
 /**
  * Read an IOElements' contents completely into a buffer in a single call.
  *
  * @param   io.streams.InputStream s
  * @return  string
  * @throws  io.IOException
  */
 public static function readAll(InputStream $s)
 {
     $r = '';
     while ($s->available() > 0) {
         $r .= $s->read();
     }
     return $r;
 }
Ejemplo n.º 4
0
 public function available()
 {
     return $this->m_stream->available();
 }