Yioop_V9.5_Source_Code_Documentation

NonCompressor
in package
implements Compressor

Implementation of a trivial Compressor.

NonCompressor's compress and uncompress filter return the string unchanged

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 before it is inserted into a WebArchive. In this case, the filter does nothing.
compressedIntLen()  : int
Computes the length of an int when packed using the underlying compression algorithm as a fixed length string. The pack function stores ints as 4 byte strings
compressInt()  : string
Used to compress an int as a fixed length string in the format of the compression algorithm underlying the compressor. Since this compressor doesn't compress we just use pack
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, the unapplying filter does nothing.
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. Since this compressor doesn't compress we just use unpack

Methods

__construct()

Constructor does nothing

public __construct() : mixed
Return values
mixed

compress()

Applies the Compressor compress filter to a string before it is inserted into a WebArchive. In this case, the filter does nothing.

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. The pack function stores ints as 4 byte strings

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. Since this compressor doesn't compress we just use pack

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, the unapplying filter does nothing.

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. Since this compressor doesn't compress we just use unpack

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