Open Journal Systems  3.3.0
GuzzleHttp\Psr7\CachingStream Class Reference
Inheritance diagram for GuzzleHttp\Psr7\CachingStream:
Psr\Http\Message\StreamInterface

Public Member Functions

 __construct (StreamInterface $stream, StreamInterface $target=null)
 
 close ()
 
 eof ()
 
 getSize ()
 
 read ($length)
 
 rewind ()
 
 seek ($offset, $whence=SEEK_SET)
 
 write ($string)
 
- Public Member Functions inherited from Psr\Http\Message\StreamInterface
 __toString ()
 
 detach ()
 
 getContents ()
 
 getMetadata ($key=null)
 
 isReadable ()
 
 isSeekable ()
 
 isWritable ()
 
 tell ()
 

Detailed Description

Stream decorator that can cache previously read bytes from a sequentially read stream.

Definition at line 10 of file CachingStream.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Psr7\CachingStream::__construct ( StreamInterface  $stream,
StreamInterface  $target = null 
)

We will treat the buffer object as the body of the stream

Parameters
StreamInterface$streamStream to cache
StreamInterface$targetOptionally specify where data is cached

Definition at line 32 of file CachingStream.php.

Member Function Documentation

◆ close()

GuzzleHttp\Psr7\CachingStream::close ( )

Close both the remote stream and buffer stream

Implements Psr\Http\Message\StreamInterface.

Definition at line 132 of file CachingStream.php.

◆ eof()

GuzzleHttp\Psr7\CachingStream::eof ( )

Returns true if the stream is at the end of the stream.

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 124 of file CachingStream.php.

◆ getSize()

GuzzleHttp\Psr7\CachingStream::getSize ( )

Get the size of the stream if known.

Returns
int|null Returns the size in bytes if known, or null if unknown.

Implements Psr\Http\Message\StreamInterface.

Definition at line 40 of file CachingStream.php.

◆ read()

GuzzleHttp\Psr7\CachingStream::read (   $length)

Read data from the stream.

Parameters
int$lengthRead 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.
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 81 of file CachingStream.php.

Referenced by GuzzleHttp\Psr7\CachingStream\seek().

◆ rewind()

GuzzleHttp\Psr7\CachingStream::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).

See also
seek() on failure.

Implements Psr\Http\Message\StreamInterface.

Definition at line 45 of file CachingStream.php.

References GuzzleHttp\Psr7\CachingStream\seek().

◆ seek()

◆ write()

GuzzleHttp\Psr7\CachingStream::write (   $string)

Write data to the stream.

Parameters
string$stringThe string that is to be written.
Returns
int Returns the number of bytes written to the stream.
Exceptions

Implements Psr\Http\Message\StreamInterface.

Definition at line 110 of file CachingStream.php.

References Psr\Http\Message\StreamInterface\tell().


The documentation for this class was generated from the following file: