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

Public Member Functions

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

Detailed Description

Decorator used to return only a subset of a stream

Definition at line 10 of file LimitStream.php.

Constructor & Destructor Documentation

◆ __construct()

GuzzleHttp\Psr7\LimitStream::__construct ( StreamInterface  $stream,
  $limit = -1,
  $offset = 0 
)
Parameters
StreamInterface$streamStream to wrap
int$limitTotal number of bytes to allow to be read from the stream. Pass -1 for no limit.
int$offsetPosition to seek to before reading (only works on seekable streams).

Definition at line 33 of file LimitStream.php.

References GuzzleHttp\Psr7\LimitStream\setLimit(), and GuzzleHttp\Psr7\LimitStream\setOffset().

Member Function Documentation

◆ eof()

GuzzleHttp\Psr7\LimitStream::eof ( )

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

Returns
bool

Implements Psr\Http\Message\StreamInterface.

Definition at line 43 of file LimitStream.php.

◆ getSize()

GuzzleHttp\Psr7\LimitStream::getSize ( )

Returns the size of the limited subset of data {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 62 of file LimitStream.php.

◆ read()

GuzzleHttp\Psr7\LimitStream::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 144 of file LimitStream.php.

◆ seek()

◆ setLimit()

GuzzleHttp\Psr7\LimitStream::setLimit (   $limit)

Set the limit of bytes that the decorator allows to be read from the stream.

Parameters
int$limitNumber of bytes to allow to be read from the stream. Use -1 for no limit.

Definition at line 139 of file LimitStream.php.

Referenced by GuzzleHttp\Psr7\LimitStream\__construct().

◆ setOffset()

GuzzleHttp\Psr7\LimitStream::setOffset (   $offset)

Set the offset to start limiting from

Parameters
int$offsetOffset to seek to and begin byte limiting from
Exceptions

Definition at line 114 of file LimitStream.php.

Referenced by GuzzleHttp\Psr7\LimitStream\__construct().

◆ tell()

GuzzleHttp\Psr7\LimitStream::tell ( )

Give a relative tell() {Returns the current position of the file read/write pointer

Returns
int Position of the file pointer
Exceptions
}

Implements Psr\Http\Message\StreamInterface.

Definition at line 102 of file LimitStream.php.


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