/** * 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; }
/** * 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; }
/** * 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; }
public function available() { return $this->m_stream->available(); }