Class ReadLimitEntityBody
EntityBody decorator used to return only a subset of an entity body
- Guzzle\Http\AbstractEntityBodyDecorator implements Guzzle\Http\EntityBodyInterface
- Guzzle\Http\ReadLimitEntityBody
Methods summary
-
public
__construct ( Guzzle\Http\EntityBodyInterface $body, int $limit, int $offset = 0 )
-
public
__toString ( )
Returns only a subset of the decorated entity body when cast as a string Convert the stream to a string if the stream is readable and the stream is seekable.
-
public
isConsumed ( )
Check if the stream has been consumed
-
public
getContentLength ( )
Returns the Content-Length of the limited subset of data Get the Content-Length of the entity body if possible (alias of getSize)
-
public
seek ( int $offset, int $whence = SEEK_SET )
Allow for a bounded seek on the read limited entity body Seek to a position in the stream
-
public
setOffset ( int $offset )
Set the offset to start limiting from
-
public
setLimit ( int $limit )
Set the limit of bytes that the decorator allows to be read from the stream
-
public
read ( int $length )
Read data from the stream
Methods detail
Parameters
- $body
Guzzle\Http\EntityBodyInterface
$body Body to wrap- $limit
integer
$limit Total number of bytes to allow to be read from the stream- $offset
integer
$offset Position to seek to before reading (only works on seekable streams)
Overrides
Returns only a subset of the decorated entity body when cast as a string Convert the stream to a string if the stream is readable and the stream is seekable.
Returns
string
Overrides
Check if the stream has been consumed
Returns
boolean
Overrides
Returns the Content-Length of the limited subset of data Get the Content-Length of the entity body if possible (alias of getSize)
Returns
integer|boolean
Returns the Content-Length or false on failure
Overrides
Allow for a bounded seek on the read limited entity body Seek to a position in the stream
Parameters
- $offset
integer
$offset Stream offset- $whence
integer
$whence Where the offset is applied
Returns
boolean
Returns TRUE on success or FALSE on failure
Overrides
Set the offset to start limiting from
Parameters
- $offset
integer
$offset Offset to seek to and begin byte limiting from
Returns
Set the limit of bytes that the decorator allows to be read from the stream
Parameters
- $limit
integer
$limit Total number of bytes to allow to be read from the stream
Returns
Read data from the stream
Parameters
- $length
integer
$length Up to length number of bytes read.
Returns
string|boolean
Returns the data read from the stream or FALSE on failure or EOF
Overrides
Methods inherited from Guzzle\Http\AbstractEntityBodyDecorator
__call()
,
close()
,
compress()
,
detachStream()
,
feof()
,
ftell()
,
getContentEncoding()
,
getContentMd5()
,
getContentType()
,
getCustomData()
,
getMetaData()
,
getSize()
,
getStream()
,
getStreamType()
,
getUri()
,
getWrapper()
,
getWrapperData()
,
isLocal()
,
isReadable()
,
isRepeatable()
,
isSeekable()
,
isWritable()
,
readLine()
,
rewind()
,
setCustomData()
,
setRewindFunction()
,
setSize()
,
setStream()
,
uncompress()
,
write()
Magic methods summary
Properties summary
protected
integer
|
$limit |
#
Limit the number of bytes that can be read |
protected
integer
|
$offset |
#
Offset to start reading from |