Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. InflateStream.php

class InflateStream

Uses PHP's zlib.inflate filter to inflate zlib (HTTP deflate, RFC1950) or gzipped (RFC1952) content.

This stream decorator converts the provided stream to a PHP stream resource, then appends the zlib.inflate filter. The stream is then converted back to a Guzzle stream resource to be used as a Guzzle stream.

Hierarchy

  • class \GuzzleHttp\Psr7\InflateStream implements \Psr\Http\Message\StreamInterface uses \GuzzleHttp\Psr7\StreamDecoratorTrait

Expanded class hierarchy of InflateStream

See also

https://datatracker.ietf.org/doc/html/rfc1950

https://datatracker.ietf.org/doc/html/rfc1952

https://www.php.net/manual/en/filters.compression.php

File

vendor/guzzlehttp/psr7/src/InflateStream.php, line 20

Namespace

GuzzleHttp\Psr7
View source
final class InflateStream implements StreamInterface {
    use StreamDecoratorTrait;
    
    /** @var StreamInterface */
    private $stream;
    public function __construct(StreamInterface $stream) {
        $resource = StreamWrapper::getResource($stream);
        // Specify window=15+32, so zlib will use header detection to both gzip (with header) and zlib data
        // See https://www.zlib.net/manual.html#Advanced definition of inflateInit2
        // "Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection"
        // Default window size is 15.
        stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ, [
            'window' => 15 + 32,
        ]);
        $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
InflateStream::$stream private property @var StreamInterface
InflateStream::__construct public function Overrides StreamDecoratorTrait::__construct
StreamDecoratorTrait::close public function 1
StreamDecoratorTrait::createStream protected function Implement in subclasses to dynamically create streams when requested. 2
StreamDecoratorTrait::detach public function
StreamDecoratorTrait::eof public function 2
StreamDecoratorTrait::getContents public function
StreamDecoratorTrait::getMetadata public function
StreamDecoratorTrait::getSize public function 2
StreamDecoratorTrait::isReadable public function
StreamDecoratorTrait::isSeekable public function 1
StreamDecoratorTrait::isWritable public function 1
StreamDecoratorTrait::read public function 2
StreamDecoratorTrait::rewind public function 1
StreamDecoratorTrait::seek public function 3
StreamDecoratorTrait::tell public function 1
StreamDecoratorTrait::write public function 2
StreamDecoratorTrait::__call public function Allow decorators to implement custom methods
StreamDecoratorTrait::__get public function Magic method used to create a new stream if streams are not added in
the constructor of a decorator (e.g., LazyOpenStream).
StreamDecoratorTrait::__toString public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal