Lines Matching full:stream
2 namespace GuzzleHttp\Stream;
4 use GuzzleHttp\Stream\Exception\SeekException;
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) argument
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
88 * @param StreamInterface $source Stream to read from
89 * @param StreamInterface $dest Stream to write to
91 * to read the entire stream.
122 * Calculate a hash of a Stream
124 * @param StreamInterface $stream Stream to calculate the hash for
128 * @return string Returns the hash of the stream
132 StreamInterface $stream, argument
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) argument
168 while (!$stream->eof()) {
169 if (false === ($byte = $stream->read(1))) {
183 * Alias of GuzzleHttp\Stream\Stream::factory.
186 * @param array $options Associative array of stream options defined in
187 * {@see \GuzzleHttp\Stream\Stream::__construct}
191 * @see GuzzleHttp\Stream\Stream::factory
192 * @see GuzzleHttp\Stream\Stream::__construct
196 return Stream::factory($resource, $options);