Filter
2 years ago
ChunkStream.php
2 years ago
CompressStream.php
6 months ago
DechunkStream.php
2 years ago
DecompressStream.php
6 months ago
DeflateStream.php
6 months ago
FilteredStream.php
6 months ago
GzipDecodeStream.php
6 months ago
GzipEncodeStream.php
6 months ago
InflateStream.php
6 months ago
DeflateStream.php
43 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaHttp\Message\Encoding; |
| 4 | |
| 5 | use AmeliaClue\StreamFilter as Filter; |
| 6 | use AmeliaVendor\Psr\Http\Message\StreamInterface; |
| 7 | |
| 8 | /** |
| 9 | * Stream deflate (RFC 1951). |
| 10 | * |
| 11 | * @author Joel Wurtz <joel.wurtz@gmail.com> |
| 12 | */ |
| 13 | class DeflateStream extends FilteredStream |
| 14 | { |
| 15 | /** |
| 16 | * @param StreamInterface $stream |
| 17 | * @param int $level |
| 18 | */ |
| 19 | public function __construct(StreamInterface $stream, $level = -1) |
| 20 | { |
| 21 | parent::__construct($stream, ['window' => -15, 'level' => $level]); |
| 22 | |
| 23 | // @deprecated will be removed in 2.0 |
| 24 | $this->writeFilterCallback = Filter\fun($this->writeFilter(), ['window' => -15]); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * {@inheritdoc} |
| 29 | */ |
| 30 | protected function readFilter() |
| 31 | { |
| 32 | return 'zlib.deflate'; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * {@inheritdoc} |
| 37 | */ |
| 38 | protected function writeFilter() |
| 39 | { |
| 40 | return 'zlib.inflate'; |
| 41 | } |
| 42 | } |
| 43 |