67 $this->tellPos =
false;
96 public function seek($offset, $whence = SEEK_SET)
98 throw new \RuntimeException(
'Cannot seek a PumpStream');
108 throw new \RuntimeException(
'Cannot write to a PumpStream');
118 $data = $this->buffer->read($length);
119 $readLen = strlen(
$data);
120 $this->tellPos += $readLen;
126 $this->tellPos += strlen(
$data) - $readLen;
135 while (!$this->
eof()) {
148 return isset($this->metadata[
$key]) ? $this->metadata[
$key] : null;
155 $data = call_user_func($this->source, $length);
157 $this->source = null;
160 $this->buffer->write(
$data);
161 $length -= strlen(
$data);
162 }
while ($length > 0);
__construct(callable $source, array $options=[])
detach()
Separates any underlying resources from the stream.
tell()
Returns the current position of the file read/write pointer.
read($length)
Read data from the stream.
isWritable()
Returns whether or not the stream is writable.
Provides a buffer stream that can be written to to fill a buffer, and read from to remove bytes from ...
if($state['core:TerminatedAssocId'] !==null) $remaining
write($string)
Write data to the stream.
Provides a read only stream that pumps data from a PHP callable.
getSize()
Get the size of the stream if known.
seek($offset, $whence=SEEK_SET)
Seek to a position in the stream.
eof()
Returns true if the stream is at the end of the stream.
isReadable()
Returns whether or not the stream is readable.
close()
Closes the stream and any underlying resources.
rewind()
Seek to the beginning of the stream.
getMetadata($key=null)
Get stream metadata as an associative array or retrieve a specific key.
isSeekable()
Returns whether or not the stream is seekable.
getContents()
Returns the remaining contents in a string.
copy_to_string(StreamInterface $stream, $maxLen=-1)
Copy the contents of a stream into a string until the given number of bytes have been read...
__toString()
Reads all data from the stream into a string, from the beginning to end.