| 3 |
liveuser |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace Guzzle\Http;
|
|
|
4 |
|
|
|
5 |
use Guzzle\Stream\StreamInterface;
|
|
|
6 |
|
|
|
7 |
/**
|
|
|
8 |
* Entity body used with an HTTP request or response
|
|
|
9 |
*/
|
|
|
10 |
interface EntityBodyInterface extends StreamInterface
|
|
|
11 |
{
|
|
|
12 |
/**
|
|
|
13 |
* Specify a custom callback used to rewind a non-seekable stream. This can be useful entity enclosing requests
|
|
|
14 |
* that are redirected.
|
|
|
15 |
*
|
|
|
16 |
* @param mixed $callable Callable to invoke to rewind a non-seekable stream. The callback must accept an
|
|
|
17 |
* EntityBodyInterface object, perform the rewind if possible, and return a boolean
|
|
|
18 |
* representing whether or not the rewind was successful.
|
|
|
19 |
* @return self
|
|
|
20 |
*/
|
|
|
21 |
public function setRewindFunction($callable);
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* If the stream is readable, compress the data in the stream using deflate compression. The uncompressed stream is
|
|
|
25 |
* then closed, and the compressed stream then becomes the wrapped stream.
|
|
|
26 |
*
|
|
|
27 |
* @param string $filter Compression filter
|
|
|
28 |
*
|
|
|
29 |
* @return bool Returns TRUE on success or FALSE on failure
|
|
|
30 |
*/
|
|
|
31 |
public function compress($filter = 'zlib.deflate');
|
|
|
32 |
|
|
|
33 |
/**
|
|
|
34 |
* Decompress a deflated string. Once uncompressed, the uncompressed string is then used as the wrapped stream.
|
|
|
35 |
*
|
|
|
36 |
* @param string $filter De-compression filter
|
|
|
37 |
*
|
|
|
38 |
* @return bool Returns TRUE on success or FALSE on failure
|
|
|
39 |
*/
|
|
|
40 |
public function uncompress($filter = 'zlib.inflate');
|
|
|
41 |
|
|
|
42 |
/**
|
|
|
43 |
* Get the Content-Length of the entity body if possible (alias of getSize)
|
|
|
44 |
*
|
|
|
45 |
* @return int|bool Returns the Content-Length or false on failure
|
|
|
46 |
*/
|
|
|
47 |
public function getContentLength();
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* Guess the Content-Type of a local stream
|
|
|
51 |
*
|
|
|
52 |
* @return string|null
|
|
|
53 |
* @see http://www.php.net/manual/en/function.finfo-open.php
|
|
|
54 |
*/
|
|
|
55 |
public function getContentType();
|
|
|
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Get an MD5 checksum of the stream's contents
|
|
|
59 |
*
|
|
|
60 |
* @param bool $rawOutput Whether or not to use raw output
|
|
|
61 |
* @param bool $base64Encode Whether or not to base64 encode raw output (only if raw output is true)
|
|
|
62 |
*
|
|
|
63 |
* @return bool|string Returns an MD5 string on success or FALSE on failure
|
|
|
64 |
*/
|
|
|
65 |
public function getContentMd5($rawOutput = false, $base64Encode = false);
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
* Get the Content-Encoding of the EntityBody
|
|
|
69 |
*
|
|
|
70 |
* @return bool|string
|
|
|
71 |
*/
|
|
|
72 |
public function getContentEncoding();
|
|
|
73 |
}
|