Lines Matching full:stream
8 * PHP stream implementation.
10 * @var $stream
12 class Stream implements StreamInterface class
25 private $stream; variable in GuzzleHttp\\Psr7\\Stream
36 * - size: (int) If a read stream would otherwise have an indeterminate
40 * of the stream is accessed.
42 * @param resource $stream Stream resource to wrap.
45 * @throws \InvalidArgumentException if the stream is not a stream resource
47 public function __construct($stream, $options = []) argument
49 if (!is_resource($stream)) {
50 throw new \InvalidArgumentException('Stream must be a resource');
61 $this->stream = $stream;
62 $meta = stream_get_meta_data($this->stream);
70 * Closes the stream when the destructed
91 if (!isset($this->stream)) {
92 throw new \RuntimeException('Stream is detached');
95 $contents = stream_get_contents($this->stream);
98 throw new \RuntimeException('Unable to read stream contents');
106 if (isset($this->stream)) {
107 if (is_resource($this->stream)) {
108 fclose($this->stream);
116 if (!isset($this->stream)) {
120 $result = $this->stream;
121 unset($this->stream);
134 if (!isset($this->stream)) {
138 // Clear the stat cache if the stream has a URI
143 $stats = fstat($this->stream);
169 if (!isset($this->stream)) {
170 throw new \RuntimeException('Stream is detached');
173 return feof($this->stream);
178 if (!isset($this->stream)) {
179 throw new \RuntimeException('Stream is detached');
182 $result = ftell($this->stream);
185 throw new \RuntimeException('Unable to determine stream position');
200 if (!isset($this->stream)) {
201 throw new \RuntimeException('Stream is detached');
204 throw new \RuntimeException('Stream is not seekable');
206 if (fseek($this->stream, $offset, $whence) === -1) {
207 throw new \RuntimeException('Unable to seek to stream position '
214 if (!isset($this->stream)) {
215 throw new \RuntimeException('Stream is detached');
218 throw new \RuntimeException('Cannot read from non-readable stream');
228 $string = fread($this->stream, $length);
230 throw new \RuntimeException('Unable to read from stream');
238 if (!isset($this->stream)) {
239 throw new \RuntimeException('Stream is detached');
242 throw new \RuntimeException('Cannot write to a non-writable stream');
247 $result = fwrite($this->stream, $string);
250 throw new \RuntimeException('Unable to write to stream');
258 if (!isset($this->stream)) {
261 return $this->customMetadata + stream_get_meta_data($this->stream);
266 $meta = stream_get_meta_data($this->stream);