SDK for PHP V3

InflateStream
in package
implements StreamInterface Uses StreamDecoratorTrait, NonSerializableStreamTrait

FinalYes

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.

Tags
see
https://datatracker.ietf.org/doc/html/rfc1950
see
https://datatracker.ietf.org/doc/html/rfc1952
see
https://www.php.net/manual/en/filters.compression.php

Table of Contents

Interfaces

StreamInterface
Describes a data stream.

Methods

__call()  : mixed
Allow decorators to implement custom methods
__construct()  : mixed
__get()  : StreamInterface
Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
__toString()  : string
close()  : void
Closes the stream and any underlying resources.
detach()  : resource|null
Separates any underlying resources from the stream.
eof()  : bool
getContents()  : string
getMetadata()  : mixed
getSize()  : int|null
isReadable()  : bool
isSeekable()  : bool
isWritable()  : bool
read()  : string
Read data from the stream.
rewind()  : void
seek()  : void
tell()  : int
write()  : int

Methods

__call()

Allow decorators to implement custom methods

public __call(string $method, array<string|int, mixed> $args) : mixed
Parameters
$method : string
$args : array<string|int, mixed>

__get()

Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).

public __get(string $name) : StreamInterface
Parameters
$name : string
Return values
StreamInterface

__toString()

public __toString() : string
Return values
string

close()

Closes the stream and any underlying resources.

public close() : void

detach()

Separates any underlying resources from the stream.

public detach() : resource|null

After the stream has been detached, the stream is in an unusable state.

Return values
resource|null

Underlying PHP stream, if any

eof()

public eof() : bool
Return values
bool

getContents()

public getContents() : string
Return values
string

getMetadata()

public getMetadata([string|null $key = null ]) : mixed
Parameters
$key : string|null = null

getSize()

public getSize() : int|null
Return values
int|null

isReadable()

public isReadable() : bool
Return values
bool

isSeekable()

public isSeekable() : bool
Return values
bool

isWritable()

public isWritable() : bool
Return values
bool

read()

Read data from the stream.

public read(int $length) : string
Parameters
$length : int

Read up to $length bytes from the object and return them. Fewer than $length bytes may be returned if underlying stream call returns fewer bytes.

Return values
string

Returns the data read from the stream, or an empty string if no bytes are available.

rewind()

public rewind() : void

seek()

public seek(int $offset[, int $whence = SEEK_SET ]) : void
Parameters
$offset : int
$whence : int = SEEK_SET

tell()

public tell() : int
Return values
int

write()

public write(string $string) : int
Parameters
$string : string
Return values
int
<-- modeled_exceptions -->
On this page