\seekquarry\yioop\library\compressorsGzipCompressor

Implementation of a Compressor using GZIP/GUNZIP as the filter.

More details on these algorithms can be found at http://en.wikipedia.org/wiki/Gzip

Summary

Methods
Properties
Constants
__construct()
compress()
uncompress()
compressInt()
uncompressInt()
compressedIntLen()
fileExtension()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

Constructor does nothing

compress()

compress(string  $str) : string

Applies the Compressor compress filter to a string before it is inserted into a WebArchive. In this case, applying the filter means gzipping.

Parameters

string $str

string to apply filter to

Returns

string —

the result of applying the filter

uncompress()

uncompress(string  $str) : string

Used to unapply the compress filter as when data is read out of a WebArchive. In this case, unapplying the filter means gunzipping.

Parameters

string $str

data read from a string archive

Returns

string —

result of uncompressing

compressInt()

compressInt(integer  $my_int) : string

Used to compress an int as a fixed length string in the format of the compression algorithm underlying the compressor. For gzip we use RFC 1952 http://www.gzip.org/zlib/rfc-gzip.html and we store the int over the modified timestamp in the header of a compressed empty string. Hence, this will always be of fixed length 20.

Parameters

integer $my_int

the integer to compress as a fixed length string

Returns

string —

the fixed length string containing the packed int

uncompressInt()

uncompressInt(string  $my_compressed_int) : integer

Used to uncompress an int from a fixed length string in the format of the compression algorithm underlying the compressor. For gzip we use RFC 1952 http://www.gzip.org/zlib/rfc-gzip.html and we store the int over the modified timestamp in the header of a compressed empty string. This has length 4 bytes starting at byte 4 of the gzip header.

Parameters

string $my_compressed_int

the fixed length string containing the packed int to extract

Returns

integer —

the integer contained in that string

compressedIntLen()

compressedIntLen() : integer

Computes the length of an int when packed using the underlying compression algorithm as a fixed length string. For gzip we use RFC 1952 http://www.gzip.org/zlib/rfc-gzip.html and we store the int over the modified timestamp in the header of a compressed empty string. Hence, this will always be of fixed length 20.

Returns

integer —

length of int as a fixed length compressed string

fileExtension()

fileExtension() : string

File extension that should be associated with this compressor

Returns

string —

name of dos file extension