Class CachingStream
Stream decorator that can cache previously read bytes from a sequentially
read stream.
-
GuzzleHttp\Psr7\CachingStream
implements
Psr\Http\Message\StreamInterface
uses
GuzzleHttp\Psr7\StreamDecoratorTrait
Methods summary
public
|
|
public
integer|null
|
#
getSize( )
Get the size of the stream if known.
Get the size of the stream if known.
Returns
integer|null Returns the size in bytes if known, or null if unknown.
Implementation of
|
public
|
#
rewind( )
Seek to the beginning of the stream.
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).
Throws
RuntimeException on failure.
See
Link
Implementation of
|
public
|
#
seek( integer $offset, integer $whence = SEEK_SET )
Seek to a position in the stream.
Seek to a position in the stream.
Parameters
- $offset
- Stream offset
- $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.
Throws
RuntimeException on failure.
Link
Implementation of
|
public
string
|
#
read( integer $length )
Read data from the stream.
Read data from the stream.
Parameters
- $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.
Returns
string Returns the data read from the stream, or an empty string
if no bytes are available.
Throws
RuntimeException if an error occurs.
Implementation of
|
public
integer
|
#
write( string $string )
Write data to the stream.
Write data to the stream.
Parameters
- $string
- The string that is to be written.
Returns
integer Returns the number of bytes written to the stream.
Throws
RuntimeException on failure.
Implementation of
|
public
boolean
|
#
eof( )
Returns true if the stream is at the end of the stream.
Returns true if the stream is at the end of the stream.
Returns
boolean
Implementation of
|
public
|
#
close( )
Close both the remote stream and buffer stream
Close both the remote stream and buffer stream
Implementation of
|
Methods used from GuzzleHttp\Psr7\StreamDecoratorTrait
__call(),
__get(),
__toString(),
createStream(),
detach(),
getContents(),
getMetadata(),
isReadable(),
isSeekable(),
isWritable(),
tell()
|