class Dechunk extends Stream (View source)

A stream decoding data encoded with chunked transfer encoding.

Constants

FLUSH_NONE

Do no intermittent flushes.

FLUSH_SYNC

Flush at appropriate transfer points.

FLUSH_FULL

Flush at each IO operation.

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|false
decode(string $data, int $decoded_len = 0)

Decode chunked encoded data.

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|false decode(string $data, int $decoded_len = 0)

Decode chunked encoded data.

Parameters

string $data

The data to decode.

int $decoded_len

Out parameter with the length of $data that's been decoded. Should be strlen($data) if not truncated.

Return Value

string|false

string the decoded data. or string the unencoded data. or string the truncated decoded data. or false if $data cannot be decoded.