ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Reads from multiple streams, one after the other. More...
Public Member Functions | |
__construct (array $streams=[]) | |
__toString () | |
Reads all data from the stream into a string, from the beginning to end. More... | |
addStream (StreamInterface $stream) | |
Add a stream to the AppendStream. More... | |
getContents () | |
Returns the remaining contents in a string. More... | |
close () | |
Closes each attached stream. More... | |
detach () | |
Detaches each attached stream. More... | |
tell () | |
Returns the current position of the file read/write pointer. More... | |
getSize () | |
Tries to calculate the size by adding the size of each stream. More... | |
eof () | |
Returns true if the stream is at the end of the stream. More... | |
rewind () | |
Seek to the beginning of the stream. More... | |
seek ($offset, $whence=SEEK_SET) | |
Attempts to seek to the given position. More... | |
read ($length) | |
Reads from all of the appended streams until the length is met or EOF. More... | |
isReadable () | |
Returns whether or not the stream is readable. More... | |
isWritable () | |
Returns whether or not the stream is writable. More... | |
isSeekable () | |
Returns whether or not the stream is seekable. More... | |
write ($string) | |
Write data to the stream. More... | |
getMetadata ($key=null) | |
Get stream metadata as an associative array or retrieve a specific key. More... | |
Private Attributes | |
$streams = [] | |
$seekable = true | |
$current = 0 | |
$pos = 0 | |
$detached = false | |
Reads from multiple streams, one after the other.
This is a read-only stream decorator.
Definition at line 11 of file AppendStream.php.
GuzzleHttp\Psr7\AppendStream::__construct | ( | array | $streams = [] | ) |
StreamInterface[] | $streams Streams to decorate. Each stream must be readable. |
Definition at line 25 of file AppendStream.php.
References GuzzleHttp\Psr7\$stream, GuzzleHttp\Psr7\AppendStream\$streams, and GuzzleHttp\Psr7\AppendStream\addStream().
GuzzleHttp\Psr7\AppendStream::__toString | ( | ) |
Reads all data from the stream into a string, from the beginning to end.
This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.
Warning: This could attempt to load a large amount of data into memory.
This method MUST NOT raise an exception in order to conform with PHP's string casting operations.
Implements Psr\Http\Message\StreamInterface.
Definition at line 32 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\getContents(), and GuzzleHttp\Psr7\AppendStream\rewind().
GuzzleHttp\Psr7\AppendStream::addStream | ( | StreamInterface | $stream | ) |
Add a stream to the AppendStream.
StreamInterface | $stream | Stream to append. Must be readable. |
Definition at line 49 of file AppendStream.php.
References GuzzleHttp\Psr7\$stream, Psr\Http\Message\StreamInterface\isReadable(), and Psr\Http\Message\StreamInterface\isSeekable().
Referenced by GuzzleHttp\Psr7\AppendStream\__construct(), and GuzzleHttp\Psr7\MultipartStream\addElement().
GuzzleHttp\Psr7\AppendStream::close | ( | ) |
Closes each attached stream.
{Closes the stream and any underlying resources.
Implements Psr\Http\Message\StreamInterface.
Definition at line 73 of file AppendStream.php.
References GuzzleHttp\Psr7\$stream.
Referenced by GuzzleHttp\Psr7\AppendStream\detach().
GuzzleHttp\Psr7\AppendStream::detach | ( | ) |
Detaches each attached stream.
{Separates any underlying resources from the stream.After the stream has been detached, the stream is in an unusable state.
Implements Psr\Http\Message\StreamInterface.
Definition at line 89 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\close().
GuzzleHttp\Psr7\AppendStream::eof | ( | ) |
Returns true if the stream is at the end of the stream.
Implements Psr\Http\Message\StreamInterface.
Definition at line 123 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\$current.
Referenced by GuzzleHttp\Psr7\AppendStream\read(), and GuzzleHttp\Psr7\AppendStream\seek().
GuzzleHttp\Psr7\AppendStream::getContents | ( | ) |
Returns the remaining contents in a string.
Implements Psr\Http\Message\StreamInterface.
Definition at line 63 of file AppendStream.php.
References GuzzleHttp\Psr7\copy_to_string().
Referenced by GuzzleHttp\Psr7\AppendStream\__toString().
GuzzleHttp\Psr7\AppendStream::getMetadata | ( | $key = null | ) |
Get stream metadata as an associative array or retrieve a specific key.
The keys returned are identical to the keys returned from PHP's stream_get_meta_data() function.
Implements Psr\Http\Message\StreamInterface.
Definition at line 229 of file AppendStream.php.
References $key.
GuzzleHttp\Psr7\AppendStream::getSize | ( | ) |
Tries to calculate the size by adding the size of each stream.
If any of the streams do not return a valid number, then the size of the append stream cannot be determined and null is returned.
{Get the size of the stream if known.
Implements Psr\Http\Message\StreamInterface.
Definition at line 108 of file AppendStream.php.
References $s, $size, and GuzzleHttp\Psr7\$stream.
GuzzleHttp\Psr7\AppendStream::isReadable | ( | ) |
Returns whether or not the stream is readable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 209 of file AppendStream.php.
GuzzleHttp\Psr7\AppendStream::isSeekable | ( | ) |
Returns whether or not the stream is seekable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 219 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\$seekable.
GuzzleHttp\Psr7\AppendStream::isWritable | ( | ) |
Returns whether or not the stream is writable.
Implements Psr\Http\Message\StreamInterface.
Definition at line 214 of file AppendStream.php.
GuzzleHttp\Psr7\AppendStream::read | ( | $length | ) |
Reads from all of the appended streams until the length is met or EOF.
{Read data from the stream.
int | $length | Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes. |
Implements Psr\Http\Message\StreamInterface.
Definition at line 174 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\$current, $remaining, $result, $total, and GuzzleHttp\Psr7\AppendStream\eof().
Referenced by GuzzleHttp\Psr7\AppendStream\seek().
GuzzleHttp\Psr7\AppendStream::rewind | ( | ) |
Seek to the beginning of the stream.
If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).
Implements Psr\Http\Message\StreamInterface.
Definition at line 130 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\seek().
Referenced by GuzzleHttp\Psr7\AppendStream\__toString().
GuzzleHttp\Psr7\AppendStream::seek | ( | $offset, | |
$whence = SEEK_SET |
|||
) |
Attempts to seek to the given position.
Only supports SEEK_SET.
Implements Psr\Http\Message\StreamInterface.
Definition at line 140 of file AppendStream.php.
References $i, $result, GuzzleHttp\Psr7\$stream, GuzzleHttp\Psr7\AppendStream\eof(), and GuzzleHttp\Psr7\AppendStream\read().
Referenced by GuzzleHttp\Psr7\AppendStream\rewind().
GuzzleHttp\Psr7\AppendStream::tell | ( | ) |
Returns the current position of the file read/write pointer.
Implements Psr\Http\Message\StreamInterface.
Definition at line 95 of file AppendStream.php.
References GuzzleHttp\Psr7\AppendStream\$pos.
GuzzleHttp\Psr7\AppendStream::write | ( | $string | ) |
Write data to the stream.
string | $string | The string that is to be written. |
Implements Psr\Http\Message\StreamInterface.
Definition at line 224 of file AppendStream.php.
|
private |
Definition at line 17 of file AppendStream.php.
Referenced by GuzzleHttp\Psr7\AppendStream\eof(), and GuzzleHttp\Psr7\AppendStream\read().
|
private |
Definition at line 19 of file AppendStream.php.
|
private |
Definition at line 18 of file AppendStream.php.
Referenced by GuzzleHttp\Psr7\AppendStream\tell().
|
private |
Definition at line 16 of file AppendStream.php.
Referenced by GuzzleHttp\Psr7\AppendStream\isSeekable().
|
private |
Definition at line 14 of file AppendStream.php.
Referenced by GuzzleHttp\Psr7\AppendStream\__construct().