Lines Matching defs:stream
13 * Safely opens a PHP stream resource using a filename.
48 * Copy the contents of a stream into a string until the given number of
51 * @param StreamInterface $stream Stream to read
53 * to read the entire stream.
56 public static function copyToString(StreamInterface $stream, $maxLen = -1)
61 while (!$stream->eof()) {
62 $buf = $stream->read(1048576);
72 while (!$stream->eof() && $len < $maxLen) {
73 $buf = $stream->read($maxLen - $len);
85 * Copy the contents of a stream into another stream until the given number
91 * to read the entire stream.
124 * @param StreamInterface $stream Stream to calculate the hash for
128 * @return string Returns the hash of the stream
132 StreamInterface $stream,
136 $pos = $stream->tell();
138 if ($pos > 0 && !$stream->seek(0)) {
139 throw new SeekException($stream);
143 while (!$stream->eof()) {
144 hash_update($ctx, $stream->read(1048576));
148 $stream->seek($pos);
154 * Read a line from the stream up to the maximum allowed buffer length
156 * @param StreamInterface $stream Stream to read from
162 public static function readline(StreamInterface $stream, $maxLength = null, $eol = PHP_EOL)
168 while (!$stream->eof()) {
169 if (false === ($byte = $stream->read(1))) {
186 * @param array $options Associative array of stream options defined in