Qore Programming Language Reference Manual  0.8.11.1
Compression Functions

Functions

binary Qore::bunzip2_to_binary (binary bin)
 Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a binary object. More...
 
nothing Qore::bunzip2_to_binary ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::bunzip2_to_string (binary bin, *string encoding)
 Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a string. More...
 
nothing Qore::bunzip2_to_string ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::bzip2 (binary bin, softint level=BZ2_DEFAULT_COMPRESSION)
 Compresses the given data with the bzip2 algorithm and returns the compressed data as a binary. More...
 
binary Qore::bzip2 (string str, softint level=BZ2_DEFAULT_COMPRESSION)
 Compresses the given data with the bzip2 algorithm and returns the compressed data as a binary. More...
 
nothing Qore::bzip2 ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::compress (string str, int level=Z_DEFAULT_COMPRESSION)
 Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data. More...
 
binary Qore::compress (binary bin, int level=Z_DEFAULT_COMPRESSION)
 Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data. More...
 
nothing Qore::compress ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::gunzip_to_binary (binary bin)
 Performs zlib-based decompression of data compressed with the "gzip" algorithm (RFC 1952) and returns a binary object of the uncompressed data. More...
 
nothing Qore::gunzip_to_binary ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::gunzip_to_string (binary bin, *string encoding)
 Performs zlib-based decompression of data compressed with the "gzip" algorithm (RFC 1952) and returns a string of the uncompressed datas. More...
 
nothing Qore::gunzip_to_string ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::gzip (string str, int level=Z_DEFAULT_COMPRESSION)
 Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data. More...
 
binary Qore::gzip (binary bin, int level=Z_DEFAULT_COMPRESSION)
 Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data. More...
 
nothing Qore::gzip ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
binary Qore::uncompress_to_binary (binary bin)
 Performs zlib-based decompression of data compressed by the "deflate" algorithm (RFC 1951) and returns a binary object of the decompressed data. More...
 
nothing Qore::uncompress_to_binary ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 
string Qore::uncompress_to_string (binary bin, *string encoding)
 Performs zlib-based decompression of data compressed by the "deflate" algorithm (RFC 1951) and returns a string of the decompressed data. More...
 
nothing Qore::uncompress_to_string ()
 This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments. More...
 

Detailed Description

These functions work with compression and decompression

Function Documentation

binary Qore::bunzip2_to_binary ( binary  bin)

Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a binary object.

Parameters
binthe compressed data to decompress
Returns
the uncompressed data as a binary object
Example:
my string $str = bunzip2_to_binary($bzip2_string);
Exceptions
BZIP2-DECOMPRESS-ERRORthe bzip2 library returned an internal error during processing (possibly due to corrupt input data)
nothing Qore::bunzip2_to_binary ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::bunzip2_to_string ( binary  bin,
*string  encoding 
)

Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a string.

Parameters
binthe compressed data to decompress
encodingthe character encoding tag for the string return value; if not present, the default character encoding is assumed.
Returns
the uncompressed data as a string
Example:
my string $str = bunzip2_to_string($bzip2_string, "iso-8859-1");
Exceptions
BZIP2-DECOMPRESS-ERRORthe bzip2 library returned an internal error during processing (possibly due to corrupt input data)
nothing Qore::bunzip2_to_string ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
binary Qore::bzip2 ( binary  bin,
softint  level = BZ2_DEFAULT_COMPRESSION 
)

Compresses the given data with the bzip2 algorithm and returns the compressed data as a binary.

Parameters
binthe data to compress
levelthe compression level, must be a value between 1 and 9 inclusive, 1 = the least compression (and taking the least memory), 9 = the most compression (using the most memory). An invalid option passed to this argument will result in a BZLIB2-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
my binary $bin = compress($data);
Exceptions
BZLIB2-LEVEL-ERRORlevel must be between 1 - 9
BZIP2-COMPRESS-ERRORthe bzip2 library returned an error during processing
binary Qore::bzip2 ( string  str,
softint  level = BZ2_DEFAULT_COMPRESSION 
)

Compresses the given data with the bzip2 algorithm and returns the compressed data as a binary.

Strings are compressed without the trailing null character

Parameters
strthe data to compress
levelthe compression level, must be a value between 1 and 9 inclusive, 1 = the least compression (and taking the least memory), 9 = the most compression (using the most memory). An invalid option passed to this argument will result in a BZLIB2-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
my binary $bin = compress($str);
Exceptions
BZLIB2-LEVEL-ERRORlevel must be between 1 - 9
BZIP2-COMPRESS-ERRORthe bzip2 library returned an error during processing
nothing Qore::bzip2 ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
binary Qore::compress ( string  str,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data.

Note that strings are compressed without the trailing null character.

Parameters
strThe string to compress
levelSpecifies the compression level; must be an integer between 1 and 9, 9 meaning the highest compression level. The default value Z_DEFAULT_COMPRESSION gives a tradeoff between speed and compression size
Returns
a binary object of the compressed data
Example:
my binary $bin = compress($str_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing
binary Qore::compress ( binary  bin,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs zlib-based "deflate" data compression (RFC 1951) and returns a binary object of the compressed data.

Note that strings are compressed without the trailing null character.

Parameters
binThe binary object to compress
levelSpecifies the compression level; must be an integer between 1 and 9, 9 meaning the highest compression level. The default value Z_DEFAULT_COMPRESSION gives a tradeoff between speed and compression size
Returns
a binary object of the compressed data
Example:
my binary $bin = compress($bin_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing
nothing Qore::compress ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
binary Qore::gunzip_to_binary ( binary  bin)

Performs zlib-based decompression of data compressed with the "gzip" algorithm (RFC 1952) and returns a binary object of the uncompressed data.

Parameters
binthe compressed data to decompress
Returns
the uncompressed data as a binary object
Example:
my binary $bin = gunzip_to_string($data);
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
nothing Qore::gunzip_to_binary ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::gunzip_to_string ( binary  bin,
*string  encoding 
)

Performs zlib-based decompression of data compressed with the "gzip" algorithm (RFC 1952) and returns a string of the uncompressed datas.

Parameters
binthe compressed data to decompress
encodingthe character encoding tag for the string return value; if not present, the default character encoding is assumed.
Returns
the uncompressed data as a string
Example:
my string $str = gunzip_to_string($bin, "iso-8859-1");
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
nothing Qore::gunzip_to_string ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
binary Qore::gzip ( string  str,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data.

Strings are compressed without the trailing null character

Parameters
strthe data to compress
levelthe compression level, must be a value between 1 and 9 inclusive, 1 = the least compression (and taking the least memory), 9 = the most compression (using the most memory). An invalid option passed to this argument will result in a ZLIB-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
my binary $data = bzip($str);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORThe zlib library returned an error during processing (should not normally happen during compression)
binary Qore::gzip ( binary  bin,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs zlib-based "gzip" data compression (RFC 1952) and returns a binary object of the compressed data.

Parameters
binthe data to compress
levelthe compression level, must be a value between 1 and 9 inclusive, 1 = the least compression (and taking the least memory), 9 = the most compression (using the most memory). An invalid option passed to this argument will result in a ZLIB-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
my binary $data = gzip($bin);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORThe zlib library returned an error during processing (should not normally happen during compression)
nothing Qore::gzip ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
binary Qore::uncompress_to_binary ( binary  bin)

Performs zlib-based decompression of data compressed by the "deflate" algorithm (RFC 1951) and returns a binary object of the decompressed data.

Parameters
binthe data to decompress
Returns
a binary object of the decompressed data
Example:
my binary $bin = uncompress_to_binary($data);
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
nothing Qore::uncompress_to_binary ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP
string Qore::uncompress_to_string ( binary  bin,
*string  encoding 
)

Performs zlib-based decompression of data compressed by the "deflate" algorithm (RFC 1951) and returns a string of the decompressed data.

Parameters
binthe compressed data to decompress
encodingthe character encoding tag for the string return value; if not present, the default character encoding is assumed.
Returns
the uncompressed data as a string
Example:
my string $str = uncompress_to_string($bin, "iso-8859-1");
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
nothing Qore::uncompress_to_string ( )

This function variant does nothing at all; it is only included for backwards-compatibility with qore prior to version 0.8.0 for functions that would ignore type errors in arguments.

Code Flags:
RUNTIME_NOOP