You are here

public function InflateStream::__construct in Auth0 Single Sign On 8.2

Parameters

StreamInterface $stream Stream to decorate:

Overrides StreamDecoratorTrait::__construct

File

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

Class

InflateStream
Uses PHP's zlib.inflate filter to inflate deflate or gzipped content.

Namespace

GuzzleHttp\Psr7

Code

public function __construct(StreamInterface $stream) {

  // read the first 10 bytes, ie. gzip header
  $header = $stream
    ->read(10);
  $filenameHeaderLength = $this
    ->getLengthOfPossibleFilenameHeader($stream, $header);

  // Skip the header, that is 10 + length of filename + 1 (nil) bytes
  $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
  $resource = StreamWrapper::getResource($stream);
  stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
  $this->stream = $stream
    ->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource));
}