Class CachingEntityBody
EntityBody decorator that can cache previously read bytes from a sequentially read tstream
- Guzzle\Http\AbstractEntityBodyDecorator implements Guzzle\Http\EntityBodyInterface
-
Guzzle\Http\CachingEntityBody
Methods summary
-
public__construct ( Guzzle\Http\EntityBodyInterface $body )We will treat the buffer object as the body of the entity body
-
public__toString ( )Will give the contents of the buffer followed by the exhausted remote stream.
-
publicgetSize ( )Get the size of the stream if able
-
publicseek ( int $offset, int $whence = SEEK_SET )Seek to a position in the stream
-
publicrewind ( )Rewind to the beginning of the stream
-
publicsetRewindFunction ( mixed $callable )Does not support custom rewind functions
-
publicread ( int $length )Read data from the stream
-
publicwrite ( string $string )Write data to the stream
-
publicreadLine ( int $maxLength = null )Read a line from the stream up to the maximum allowed buffer length
-
publicisConsumed ( )Check if the stream has been consumed
-
publicclose ( )Close both the remote stream and buffer stream
-
publicsetStream ( resource $stream, int $size = 0 )Set the stream that is wrapped by the object
-
publicgetContentType ( )Guess the Content-Type of a local stream
-
publicgetContentEncoding ( )Get the Content-Encoding of the EntityBody
-
publicgetMetaData ( string $key = null )Get stream metadata
-
publicgetStream ( )Get the stream resource
-
publicgetWrapper ( )Get the stream wrapper type
-
publicgetWrapperData ( )Wrapper specific data attached to this stream.
-
publicgetStreamType ( )Get a label describing the underlying implementation of the stream
-
publicgetUri ( )Get the URI/filename associated with this stream
-
publicgetCustomData ( string $key )Always retrieve custom data from the remote stream Get custom data from the stream
-
publicsetCustomData ( string $key, mixed $value )Always set custom data on the remote stream Set custom data on the stream
Methods detail
We will treat the buffer object as the body of the entity body
Parameters
- $body
Guzzle\Http\EntityBodyInterface
$body Entity body to decorate
Overrides
Will give the contents of the buffer followed by the exhausted remote stream.
Warning: Loads the entire stream into memory
Returns
stringOverrides
Get the size of the stream if able
Returns
integer|booleanOverrides
Seek to a position in the stream
Parameters
- $offset
integer
$offset Stream offset- $whence
integer
$whence Where the offset is applied
Returns
booleanReturns TRUE on success or FALSE on failure
Throws
Guzzle\Common\Exception\RuntimeExceptionWhen seeking with SEEK_END or when seeking past the total size of the buffer stream
Overrides
Rewind to the beginning of the stream
Returns
booleanReturns true on success or false on failure
Overrides
Does not support custom rewind functions
Parameters
- $callable
mixed
$callable Callable to invoke to rewind a non-seekable stream. The callback must accept an EntityBodyInterface object, perform the rewind if possible, and return a boolean representing whether or not the rewind was successful.
Returns
Throws
Overrides
Read data from the stream
Parameters
- $length
integer
$length Up to length number of bytes read.
Returns
string|booleanReturns the data read from the stream or FALSE on failure or EOF
Overrides
Write data to the stream
Parameters
- $string
string
$string The string that is to be written.
Returns
integer|booleanReturns the number of bytes written to the stream on success or FALSE on failure.
Overrides
Read a line from the stream up to the maximum allowed buffer length
Parameters
- $maxLength
integer
$maxLength Maximum buffer length
Returns
string|booleanLink
Overrides
Check if the stream has been consumed
Returns
booleanOverrides
Close both the remote stream and buffer stream
Overrides
Set the stream that is wrapped by the object
Parameters
- $stream
resource
$stream Stream resource to wrap- $size
integer
$size Size of the stream in bytes. Only pass if the size cannot be obtained from the stream.
Returns
Overrides
Guess the Content-Type of a local stream
Returns
string|nullSee
Overrides
Get the Content-Encoding of the EntityBody
Returns
boolean|stringOverrides
Get stream metadata
Parameters
- $key
string
$key Specific metadata to retrieve
Returns
array|mixed|nullOverrides
Get the stream resource
Returns
resourceOverrides
Get the stream wrapper type
Returns
stringOverrides
Wrapper specific data attached to this stream.
Returns
arrayOverrides
Get a label describing the underlying implementation of the stream
Returns
stringOverrides
Get the URI/filename associated with this stream
Returns
stringOverrides
Always retrieve custom data from the remote stream Get custom data from the stream
Parameters
- $key
string
$key Key to retrieve
Returns
null|mixedOverrides
Always set custom data on the remote stream Set custom data on the stream
Parameters
- $key
string
$key Key to set- $value
mixed
$value Value to set
Returns
Overrides
Methods inherited from Guzzle\Http\AbstractEntityBodyDecorator
__call(),
compress(),
detachStream(),
feof(),
ftell(),
getContentLength(),
getContentMd5(),
isLocal(),
isReadable(),
isRepeatable(),
isSeekable(),
isWritable(),
setSize(),
uncompress()
Magic methods summary
Properties summary
protected
|
$remoteStream |
#
Remote stream used to actually pull data onto the buffer |
protected
integer
|
$skipReadBytes |
#
The number of bytes to skip reading due to a write on the temporary buffer |