CompressingReadableStream
in package
implements
ReadableStream, IteratorAggregate
uses
ReadableStreamIteratorAggregate, ForbidCloning, ForbidSerialization
Allows compression of input streams using Zlib.
Tags
Table of Contents
Interfaces
- ReadableStream
- A `ReadableStream` allows reading byte streams in chunks.
- IteratorAggregate
Properties
- $deflateContext : DeflateContext|null
- $encoding : int
- $options : array<string|int, mixed>
- $source : ReadableStream
Methods
- __construct() : mixed
- __serialize() : never
- __unserialize() : never
- close() : void
- Closes the resource, marking it as unusable.
- getEncoding() : int
- Gets the used compression encoding.
- getIterator() : Traversable<int, string>
- getOptions() : array<string|int, mixed>
- Gets the used compression options.
- isClosed() : bool
- Returns whether this resource has been closed.
- isReadable() : bool
- onClose() : void
- Registers a callback that is invoked when this resource is closed.
- read() : string|null
- Reads data from the stream.
- __clone() : mixed
Properties
$deflateContext
private
DeflateContext|null
$deflateContext
$encoding read-only
private
int
$encoding
$options read-only
private
array<string|int, mixed>
$options
= []
$source read-only
private
ReadableStream
$source
Methods
__construct()
public
__construct(ReadableStream $source, int $encoding[, array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $source : ReadableStream
-
Input stream to read data from.
- $encoding : int
-
Compression algorithm used, see
deflate_init(). - $options : array<string|int, mixed> = []
-
Algorithm options, see
deflate_init().
Tags
__serialize()
public
final __serialize() : never
Return values
never__unserialize()
public
final __unserialize(array<string|int, mixed> $data) : never
Parameters
- $data : array<string|int, mixed>
Return values
neverclose()
Closes the resource, marking it as unusable.
public
close() : void
Whether pending operations are aborted or not is implementation dependent.
getEncoding()
Gets the used compression encoding.
public
getEncoding() : int
Return values
int —Encoding specified on construction time.
getIterator()
public
getIterator() : Traversable<int, string>
Return values
Traversable<int, string>getOptions()
Gets the used compression options.
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —Options array passed on construction time.
isClosed()
Returns whether this resource has been closed.
public
isClosed() : bool
Return values
bool —true if closed, otherwise false.
isReadable()
public
isReadable() : bool
Return values
bool —A stream may become unreadable if the underlying source is closed or lost.
onClose()
Registers a callback that is invoked when this resource is closed.
public
onClose(Closure $onClose) : void
Parameters
- $onClose : Closure
read()
Reads data from the stream.
public
read([Cancellation|null $cancellation = null ]) : string|null
Parameters
- $cancellation : Cancellation|null = null
-
Cancel the read operation. The state in which the stream will be after a cancelled operation is implementation dependent.
Return values
string|null —Returns a string when new data is available or null if the stream has closed.
__clone()
protected
final __clone() : mixed