|
| __construct (array $streams=[]) |
|
| __toString () |
| Reads all data from the stream into a string, from the beginning to end.
|
|
| addStream (StreamInterface $stream) |
| Add a stream to the AppendStream.
|
|
| close () |
| Closes each attached stream.
|
|
| detach () |
| Detaches each attached stream.
|
|
| eof () |
| Returns true if the stream is at the end of the stream.
|
|
| getContents () |
| Returns the remaining contents in a string.
|
|
| getMetadata ($key=null) |
|
| getMetadata (?string $key=null) |
| Get stream metadata as an associative array or retrieve a specific key.
|
|
| getSize () |
| Tries to calculate the size by adding the size of each stream.
|
|
| isReadable () |
| Returns whether or not the stream is readable.
|
|
| isSeekable () |
| Returns whether or not the stream is seekable.
|
|
| isWritable () |
| Returns whether or not the stream is writable.
|
|
| read ($length) |
| Reads from all of the appended streams until the length is met or EOF.
|
|
| read (int $length) |
| Read data from the stream.
|
|
| rewind () |
| Seek to the beginning of the stream.
|
|
| seek ($offset, $whence=SEEK_SET) |
| Attempts to seek to the given position.
|
|
| seek (int $offset, int $whence=SEEK_SET) |
| Seek to a position in the stream.
|
|
| tell () |
| Returns the current position of the file read/write pointer.
|
|
| write ($string) |
|
| write (string $string) |
| Write data to the stream.
|
|
◆ __construct()
GuzzleHttp\Psr7\AppendStream::__construct |
( |
array | $streams = [] | ) |
|
- Parameters
-
StreamInterface[] | $streams | Streams to decorate. Each stream must be readable. |
◆ __toString()
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.
- See also
- http://php.net/manual/en/language.oop5.magic.php#object.tostring
- Return values
-
Implements Psr\Http\Message\StreamInterface.
◆ addStream()
Add a stream to the AppendStream.
- Parameters
-
StreamInterface | $stream | Stream to append. Must be readable. |
- Exceptions
-
InvalidArgumentException | if the stream is not readable |
◆ close()
GuzzleHttp\Psr7\AppendStream::close |
( |
| ) |
|
◆ detach()
GuzzleHttp\Psr7\AppendStream::detach |
( |
| ) |
|
◆ eof()
GuzzleHttp\Psr7\AppendStream::eof |
( |
| ) |
|
◆ getContents()
GuzzleHttp\Psr7\AppendStream::getContents |
( |
| ) |
|
Returns the remaining contents in a string.
- Return values
-
- Exceptions
-
RuntimeException | if unable to read or an error occurs while reading. |
Implements Psr\Http\Message\StreamInterface.
◆ getMetadata() [1/2]
GuzzleHttp\Psr7\AppendStream::getMetadata |
( |
| $key = null | ) |
|
◆ getMetadata() [2/2]
Psr\Http\Message\StreamInterface::getMetadata |
( |
?string | $key = null | ) |
|
|
inherited |
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.
@externalurl http://php.net/manual/en/function.stream-get-meta-data.php
- Parameters
-
string | null | $key | Specific metadata to retrieve. |
- Return values
-
array|mixed|null | Returns an associative array if no key is provided. Returns a specific key value if a key is provided and the value is found, or null if the key is not found. |
◆ getSize()
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.
Implements Psr\Http\Message\StreamInterface.
◆ isReadable()
GuzzleHttp\Psr7\AppendStream::isReadable |
( |
| ) |
|
◆ isSeekable()
GuzzleHttp\Psr7\AppendStream::isSeekable |
( |
| ) |
|
◆ isWritable()
GuzzleHttp\Psr7\AppendStream::isWritable |
( |
| ) |
|
◆ read()
Psr\Http\Message\StreamInterface::read |
( |
int | $length | ) |
|
|
inherited |
Read data from the stream.
- Parameters
-
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. |
- Return values
-
string | Returns the data read from the stream, or an empty string if no bytes are available. |
- Exceptions
-
RuntimeException | if an error occurs. |
◆ rewind()
GuzzleHttp\Psr7\AppendStream::rewind |
( |
| ) |
|
◆ seek() [1/2]
GuzzleHttp\Psr7\AppendStream::seek |
( |
| $offset, |
|
|
| $whence = SEEK_SET ) |
Attempts to seek to the given position.
Only supports SEEK_SET.
◆ seek() [2/2]
Psr\Http\Message\StreamInterface::seek |
( |
int | $offset, |
|
|
int | $whence = SEEK_SET ) |
|
inherited |
Seek to a position in the stream.
@externalurl http://www.php.net/manual/en/function.fseek.php
- Parameters
-
int | $offset | Stream offset |
int | $whence | Specifies how the cursor position will be calculated based on the seek offset. Valid values are identical to the built-in PHP $whence values for fseek() . SEEK_SET: Set position equal to offset bytes SEEK_CUR: Set position to current location plus offset SEEK_END: Set position to end-of-stream plus offset. |
- Exceptions
-
RuntimeException | on failure. |
◆ tell()
GuzzleHttp\Psr7\AppendStream::tell |
( |
| ) |
|
Returns the current position of the file read/write pointer.
- Return values
-
int | Position of the file pointer |
- Exceptions
-
RuntimeException | on error. |
Implements Psr\Http\Message\StreamInterface.
◆ write()
Psr\Http\Message\StreamInterface::write |
( |
string | $string | ) |
|
|
inherited |
Write data to the stream.
- Parameters
-
string | $string | The string that is to be written. |
- Return values
-
int | Returns the number of bytes written to the stream. |
- Exceptions
-
RuntimeException | on failure. |
The documentation for this class was generated from the following file:
- lib/guzzlehttp/psr7/src/AppendStream.php