Yioop_V9.5_Source_Code_Documentation

GzipCompressor
in package
implements Compressor

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

More details on these algorithms can be found at

Tags
author

Chris Pollett

Interfaces, Classes, Traits and Enums

Compressor
A Compressor is used to apply a filter to objects before they are stored into a WebArchive. The filter is assumed to be invertible, and the typical intention is the filter carries out some kind of string compression.

Table of Contents

__construct()  : mixed
Constructor does nothing
compress()  : string
Applies the Compressor compress filter to a string and returns the resultsting string. In this case, applying the filter means gzipping.
compressedIntLen()  : int
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.
compressInt()  : 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 https://tools.ietf.org/html/rfc1952 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.
compressPutFile()  : int
Applies the Compressor gzip filter to a string $str and then writes it to file $file_name
fileExtension()  : string
File extension that should be associated with this compressor
uncompress()  : string
Used to unapply the compress filter as when data is read out of a WebArchive. In this case, unapplying the filter means gunzipping.
uncompressGetFile()  : string
Applies the Compressor uncompress filter to the contents read from $file_name and returns the result as a string
uncompressInt()  : int
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 https://tools.ietf.org/html/rfc1952 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.

Methods

__construct()

Constructor does nothing

public __construct() : mixed
Return values
mixed

compress()

Applies the Compressor compress filter to a string and returns the resultsting string. In this case, applying the filter means gzipping.

public compress(string $str) : string
Parameters
$str : string

string to apply filter to

Return values
string

the result of applying the filter

compressedIntLen()

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.

public compressedIntLen() : int
Return values
int

length of int as a fixed length compressed string

compressInt()

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 https://tools.ietf.org/html/rfc1952 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.

public compressInt(int $my_int) : string
Parameters
$my_int : int

the integer to compress as a fixed length string

Return values
string

the fixed length string containing the packed int

compressPutFile()

Applies the Compressor gzip filter to a string $str and then writes it to file $file_name

public compressPutFile(string $file_name, string $str) : int
Parameters
$file_name : string

to write string to

$str : string

string to apply filter to

Return values
int

the number of bytes written

fileExtension()

File extension that should be associated with this compressor

public static fileExtension() : string
Return values
string

name of dos file extension

uncompress()

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

public uncompress(string $str) : string
Parameters
$str : string

data read from a string archive

Return values
string

result of uncompressing

uncompressGetFile()

Applies the Compressor uncompress filter to the contents read from $file_name and returns the result as a string

public uncompressGetFile(string $file_name) : string
Parameters
$file_name : string

to write string to

Return values
string

the uncompressed contents of the $file_name

uncompressInt()

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 https://tools.ietf.org/html/rfc1952 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.

public uncompressInt(string $my_compressed_int) : int
Parameters
$my_compressed_int : string

the fixed length string containing the packed int to extract

Return values
int

the integer contained in that string


        

Search results