Lines Matching full:stream

10  * PHP stream implementation.
12 class Stream implements StreamInterface class
22 private $stream; variable in GuzzleHttp\\Psr7\\Stream
39 * - size: (int) If a read stream would otherwise have an indeterminate
43 * of the stream is accessed.
45 * @param resource $stream Stream resource to wrap.
48 * @throws \InvalidArgumentException if the stream is not a stream resource
50 public function __construct($stream, array $options = []) argument
52 if (!is_resource($stream)) {
53 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
97 if (!isset($this->stream)) {
98 throw new \RuntimeException('Stream is detached');
102 throw new \RuntimeException('Cannot read from non-readable stream');
105 return Utils::tryGetContents($this->stream);
110 if (isset($this->stream)) {
111 if (is_resource($this->stream)) {
112 fclose($this->stream);
120 if (!isset($this->stream)) {
124 $result = $this->stream;
125 unset($this->stream);
138 if (!isset($this->stream)) {
142 // Clear the stat cache if the stream has a URI
147 $stats = fstat($this->stream);
174 if (!isset($this->stream)) {
175 throw new \RuntimeException('Stream is detached');
178 return feof($this->stream);
183 if (!isset($this->stream)) {
184 throw new \RuntimeException('Stream is detached');
187 $result = ftell($this->stream);
190 throw new \RuntimeException('Unable to determine stream position');
205 if (!isset($this->stream)) {
206 throw new \RuntimeException('Stream is detached');
209 throw new \RuntimeException('Stream is not seekable');
211 if (fseek($this->stream, $offset, $whence) === -1) {
212 throw new \RuntimeException('Unable to seek to stream position '
219 if (!isset($this->stream)) {
220 throw new \RuntimeException('Stream is detached');
223 throw new \RuntimeException('Cannot read from non-readable stream');
234 $string = fread($this->stream, $length);
236 throw new \RuntimeException('Unable to read from stream', 0, $e);
240 throw new \RuntimeException('Unable to read from stream');
248 if (!isset($this->stream)) {
249 throw new \RuntimeException('Stream is detached');
252 throw new \RuntimeException('Cannot write to a non-writable stream');
257 $result = fwrite($this->stream, $string);
260 throw new \RuntimeException('Unable to write to stream');
271 if (!isset($this->stream)) {
274 return $this->customMetadata + stream_get_meta_data($this->stream);
279 $meta = stream_get_meta_data($this->stream);