Lines Matching defs:stream
13 * A stream reader class
20 * Creates a stream reader instance by a string value.
36 * Creates a stream reader instance by a filename.
48 * Defines whether the stream should be closed when the stream reader instance is deconstructed or not.
55 * The stream resource.
59 protected $stream;
62 * The byte-offset position in the stream.
83 * The total length of the stream.
99 * @param resource $stream
100 * @param bool $closeStream Defines whether to close the stream resource if the instance is destructed or not.
102 public function __construct($stream, $closeStream = false)
104 if (!\is_resource($stream)) {
106 'No stream given.'
110 $metaData = \stream_get_meta_data($stream);
113 'Given stream is not seekable!'
117 $this->stream = $stream;
135 if ($this->closeStream && is_resource($this->stream)) {
136 \fclose($this->stream);
156 * Get the current position in the stream.
366 * Returns the stream.
372 return $this->stream;
383 $stat = \fstat($this->stream);
410 \fseek($this->stream, $pos);
413 $this->buffer = $length > 0 ? \fread($this->stream, $length) : '';
417 // If a stream wrapper is in use it is possible that
450 * @return bool Returns false if the stream reaches the end
456 if (\feof($this->stream) || $this->getTotalLength() === $this->position + $this->bufferLength) {
462 $this->buffer .= \fread($this->stream, $newLength - $this->bufferLength);
464 } while (($this->bufferLength !== $newLength) && !\feof($this->stream));