class Enbrotli extends Stream (View source)

A brotli encoding stream.

NOTE: This class has been added in v3.2.0.

Constants

FLUSH_NONE

Do no intermittent flushes.

FLUSH_SYNC

Flush at appropriate transfer points.

FLUSH_FULL

Flush at each IO operation.

LEVEL_DEF

Default compression level.

LEVEL_MIN

Least compression level.

LEVEL_MAX

Greatest compression level.

WBITS_DEF

Default window bits.

WBITS_MIN

Minimum window bits.

WBITS_MAX

Maximum window bits.

MODE_GENERIC

Default compression mode.

MODE_TEXT

Compression mode for UTF-8 formatted text.

MODE_FONT

Compression mode used in WOFF 2.0.

Methods

__construct(int $flags = 0)

Base constructor for encoding stream implementations.

from  Stream
bool
done()

Check whether the encoding stream is already done.

from  Stream
string
finish()

Finish and reset the encoding stream.

from  Stream
string
flush()

Flush the encoding stream.

from  Stream
string
update(string $data)

Update the encoding stream with more input.

from  Stream
string
encode(string $data, int $flags = 0)

Encode data with brotli encoding.

Details

__construct(int $flags = 0)

Base constructor for encoding stream implementations.

Parameters

int $flags

See http\Encoding\Stream and implementation specific constants.

Exceptions

InvalidArgumentException
RuntimeException

bool done()

Check whether the encoding stream is already done.

Return Value

bool

whether the encoding stream is completed.

string finish()

Finish and reset the encoding stream.

Returns any pending data.

Return Value

string

any pending data.

string flush()

Flush the encoding stream.

Returns any pending data.

Return Value

string

any pending data.

string update(string $data)

Update the encoding stream with more input.

Parameters

string $data

The data to pass through the stream.

Return Value

string

processed data.

string encode(string $data, int $flags = 0)

Encode data with brotli encoding.

Parameters

string $data

The data to compress.

int $flags

Any compression tuning flags. See http\Encoding\Stream\Enbrotli and http\Encoding\Stream constants.

Return Value

string

the compressed data.