Class AbstractEntityBodyDecorator
Abstract decorator used to wrap entity bodies
- Guzzle\Http\AbstractEntityBodyDecorator implements Guzzle\Http\EntityBodyInterface
Direct known subclasses
Guzzle\Http\CachingEntityBody,
Guzzle\Http\IoEmittingEntityBody,
Guzzle\Http\ReadLimitEntityBody
Methods summary
-
public__construct ( Guzzle\Http\EntityBodyInterface $body ) -
public__toString ( )Convert the stream to a string if the stream is readable and the stream is seekable.
-
public__call ( string $method, array $args )Allow decorators to implement custom methods
-
publicclose ( )Close the underlying stream
-
publicsetRewindFunction ( mixed $callable )Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
-
publicrewind ( )Rewind to the beginning of the stream
-
publiccompress ( string $filter = 'zlib.deflate' )If the stream is readable, compress the data in the stream using deflate compression. The uncompressed stream is then closed, and the compressed stream then becomes the wrapped stream.
-
publicuncompress ( string $filter = 'zlib.inflate' )Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
-
publicgetContentLength ( )Get the Content-Length of the entity body if possible (alias of getSize)
-
publicgetContentType ( )Guess the Content-Type of a local stream
-
publicgetContentMd5 ( bool $rawOutput = false, bool $base64Encode = false )Get an MD5 checksum of the stream's contents
-
publicgetContentEncoding ( )Get the Content-Encoding of the EntityBody
-
publicgetMetaData ( string $key = null )Get stream metadata
-
publicgetStream ( )Get the stream resource
-
publicsetStream ( resource $stream, int $size = 0 )Set the stream that is wrapped by the object
-
publicdetachStream ( )Detach the current 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
-
publicgetSize ( )Get the size of the stream if able
-
publicisReadable ( )Check if the stream is readable
-
publicisRepeatable ( )Check if the stream is repeatable
-
publicisWritable ( )Check if the stream is writable
-
publicisConsumed ( )Check if the stream has been consumed
-
publicfeof ( )Alias of isConsumed() Alias of isConsumed
-
publicisLocal ( )Check if the stream is a local stream vs a remote stream
-
publicisSeekable ( )Check if the string is repeatable
-
publicsetSize ( int $size )Specify the size of the stream in bytes
-
publicseek ( int $offset, int $whence = SEEK_SET )Seek to a position in the stream
-
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
-
publicftell ( )Returns the current position of the file read/write pointer
-
publicgetCustomData ( string $key )Get custom data from the stream
-
publicsetCustomData ( string $key, mixed $value )Set custom data on the stream
Methods detail
Parameters
- $body
Guzzle\Http\EntityBodyInterface
$body Entity body to decorate
Convert the stream to a string if the stream is readable and the stream is seekable.
Returns
stringImplementation of
Allow decorators to implement custom methods
Parameters
- $method
string
$method Missing method name- $args
array
$args Method arguments
Returns
mixedSpecify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests that are redirected.
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
Implementation of
Rewind to the beginning of the stream
Returns
booleanReturns true on success or false on failure
Implementation of
If the stream is readable, compress the data in the stream using deflate compression. The uncompressed stream is then closed, and the compressed stream then becomes the wrapped stream.
Parameters
- $filter
string
$filter Compression filter
Returns
booleanReturns TRUE on success or FALSE on failure
Implementation of
Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
Parameters
- $filter
string
$filter De-compression filter
Returns
booleanReturns TRUE on success or FALSE on failure
Implementation of
Get the Content-Length of the entity body if possible (alias of getSize)
Returns
integer|booleanReturns the Content-Length or false on failure
Implementation of
Guess the Content-Type of a local stream
Returns
string|nullSee
Implementation of
Get an MD5 checksum of the stream's contents
Parameters
- $rawOutput
boolean
$rawOutput Whether or not to use raw output- $base64Encode
boolean
$base64Encode Whether or not to base64 encode raw output (only if raw output is true)
Returns
boolean|stringReturns an MD5 string on success or FALSE on failure
Implementation of
Get the Content-Encoding of the EntityBody
Returns
boolean|stringImplementation of
Get stream metadata
Parameters
- $key
string
$key Specific metadata to retrieve
Returns
array|mixed|nullImplementation of
Get the stream resource
Returns
resourceImplementation of
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
Implementation of
Detach the current stream resource
Returns
Implementation of
Get the stream wrapper type
Returns
stringImplementation of
Wrapper specific data attached to this stream.
Returns
arrayImplementation of
Get a label describing the underlying implementation of the stream
Returns
stringImplementation of
Get the URI/filename associated with this stream
Returns
stringImplementation of
Get the size of the stream if able
Returns
integer|booleanImplementation of
Check if the stream is readable
Returns
booleanImplementation of
Check if the stream is repeatable
Returns
booleanImplementation of
Check if the stream is writable
Returns
booleanImplementation of
Check if the stream has been consumed
Returns
booleanImplementation of
Alias of isConsumed() Alias of isConsumed
Returns
booleanImplementation of
Check if the stream is a local stream vs a remote stream
Returns
booleanImplementation of
Check if the string is repeatable
Returns
booleanImplementation of
Specify the size of the stream in bytes
Parameters
- $size
integer
$size Size of the stream contents in bytes
Returns
Implementation of
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
Link
Implementation of
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
Implementation of
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.
Implementation of
Read a line from the stream up to the maximum allowed buffer length
Parameters
- $maxLength
integer
$maxLength Maximum buffer length
Returns
string|booleanImplementation of
Returns the current position of the file read/write pointer
Returns
integer|booleanReturns the position of the file pointer or false on error
Implementation of
Get custom data from the stream
Parameters
- $key
string
$key Key to retrieve
Returns
null|mixedImplementation of
Set custom data on the stream
Parameters
- $key
string
$key Key to set- $value
mixed
$value Value to set
Returns
Implementation of
Magic methods summary
Properties summary
protected
|
$body |
#
Decorated entity body |