2 encoding stream zlib with explicit flush
11 $defl = new http\Encoding\Stream\Deflate;
12 $infl = new http\Encoding\Stream\Inflate;
13 $file = file(__FILE__);
15 foreach ($file as $line) {
16 $data .= $infl->flush();
17 if (strlen($temp = $defl->update($line))) {
18 $data .= $infl->update($temp);
19 $data .= $infl->flush();
21 if (strlen($temp = $defl->flush())) {
22 $data .= $infl->update($temp);
23 $data .= $infl->flush();
25 $defl->done() or printf("uh-oh stream's not done yet!\n");
27 if (strlen($temp = $defl->finish())) {
28 $data .= $infl->update($temp);
30 var_dump($defl->done());
31 $data .= $infl->finish();
32 var_dump($infl->done());
33 var_dump(implode("", $file) === $data);