Compressor
in
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.
Tags
Table of Contents
- compress() : string
- Applies the Compressor compress filter to a string and returns the resultsting string.
- compressedIntLen() : int
- Computes the length of an int when packed using the underlying compression algorithm as a fixed length string
- compressInt() : string
- Used to compress an int as a fixed length string in the format of the compression algorithm underlying the compressor.
- compressPutFile() : int
- Applies the Compressor compress 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 to data in a string $string
- 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.
Methods
compress()
Applies the Compressor compress filter to a string and returns the resultsting string.
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
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.
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 compress 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 to data in a string $string
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.
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