Qore Programming Language Reference Manual 2.3.0
Loading...
Searching...
No Matches
Compression Functions

Functions

binary Qore::brotli (string str, int quality=BROTLI_DEFAULT_QUALITY)
 Compresses the given data with the Brotli algorithm (RFC 7932) and returns the compressed data as a binary.
 
binary Qore::brotli (binary bin, int quality=BROTLI_DEFAULT_QUALITY)
 Compresses the given data with the Brotli algorithm (RFC 7932) and returns the compressed data as a binary.
 
nothing Qore::brotli ()
 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.
 
binary Qore::bunzip2_to_binary (binary bin)
 Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a binary object.
 
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.
 
string Qore::bunzip2_to_string (binary bin, __7_ string encoding)
 Uncompresses the given data with the bzip2 algorithm and returns the uncompressed data as a string.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
binary Qore::deflate_raw (string str, int level=Z_DEFAULT_COMPRESSION)
 Performs raw DEFLATE compression without zlib/gzip headers or trailers.
 
binary Qore::deflate_raw (binary bin, int level=Z_DEFAULT_COMPRESSION)
 Performs raw DEFLATE compression without zlib/gzip headers or trailers.
 
nothing Qore::deflate_raw ()
 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.
 
Transform Qore::get_compressor (string alg, int level=COMPRESSION_LEVEL_DEFAULT)
 Returns a Transform object for compressing data using the given algorithm for use with TransformInputStream and TransformOutputStream.
 
Transform Qore::get_decompressor (string alg)
 Returns a Transform object for decompressing data using the given algorithm for use with TransformInputStream and TransformOutputStream.
 
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.
 
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.
 
string Qore::gunzip_to_string (binary bin, __7_ string encoding)
 Performs zlib-based decompression of data compressed with the "gzip" algorithm (RFC 1952) and returns a string of the uncompressed datas.
 
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.
 
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.
 
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.
 
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.
 
binary Qore::inflate_raw_to_binary (binary bin)
 Performs raw DEFLATE decompression and returns a binary object of the decompressed data.
 
nothing Qore::inflate_raw_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.
 
string Qore::inflate_raw_to_string (binary bin, __7_ string encoding)
 Performs raw DEFLATE decompression and returns a string of the decompressed data.
 
nothing Qore::inflate_raw_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.
 
binary Qore::lz4 (string str, int acceleration=1)
 Compresses the given data with the LZ4 algorithm and returns the compressed data as a binary.
 
binary Qore::lz4 (binary bin, int acceleration=1)
 Compresses the given data with the LZ4 algorithm and returns the compressed data as a binary.
 
nothing Qore::lz4 ()
 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.
 
binary Qore::unbrotli_to_binary (binary bin)
 Decompresses the given data with the Brotli algorithm (RFC 7932) and returns the decompressed data as a binary object.
 
nothing Qore::unbrotli_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.
 
string Qore::unbrotli_to_string (binary bin, __7_ string encoding)
 Decompresses the given data with the Brotli algorithm (RFC 7932) and returns the decompressed data as a string.
 
nothing Qore::unbrotli_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.
 
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.
 
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.
 
string Qore::uncompress_to_string (binary bin, __7_ string encoding)
 Performs zlib-based decompression of data compressed by the "deflate" algorithm (RFC 1951) and returns a string of the decompressed 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.
 
binary Qore::unlz4_to_binary (binary bin, int max_output_size=0)
 Decompresses the given data with the LZ4 algorithm and returns the decompressed data as a binary object.
 
nothing Qore::unlz4_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.
 
string Qore::unlz4_to_string (binary bin, int max_output_size=0, __7_ string encoding)
 Decompresses the given data with the LZ4 algorithm and returns the decompressed data as a string.
 
nothing Qore::unlz4_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.
 
binary Qore::unzstd_to_binary (binary bin)
 Decompresses the given data with the Zstandard algorithm (RFC 8878) and returns the decompressed data as a binary object.
 
nothing Qore::unzstd_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.
 
string Qore::unzstd_to_string (binary bin, __7_ string encoding)
 Decompresses the given data with the Zstandard algorithm (RFC 8878) and returns the decompressed data as a string.
 
nothing Qore::unzstd_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.
 
binary Qore::zstd (string str, int level=3)
 Compresses the given data with the Zstandard algorithm (RFC 8878) and returns the compressed data as a binary.
 
binary Qore::zstd (binary bin, int level=3)
 Compresses the given data with the Zstandard algorithm (RFC 8878) and returns the compressed data as a binary.
 
nothing Qore::zstd ()
 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.
 

Detailed Description

These functions work with compression and decompression

Function Documentation

◆ brotli() [1/3]

nothing Qore::brotli ( )

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
Since
Qore 2.1

◆ brotli() [2/3]

binary Qore::brotli ( binary  bin,
int  quality = BROTLI_DEFAULT_QUALITY 
)

Compresses the given data with the Brotli algorithm (RFC 7932) and returns the compressed data as a binary.

Parameters
binthe data to compress
qualitythe compression quality level, must be a value between 0 and 11 inclusive, 0 = the least compression (and fastest), 11 = the most compression (using the most memory and time). An invalid option passed to this argument will result in a BROTLI-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = brotli(data);
Exceptions
BROTLI-LEVEL-ERRORquality must be between 0 - 11 or -1
BROTLI-ERRORthe Brotli library returned an error during processing
Since
Qore 2.1

◆ brotli() [3/3]

binary Qore::brotli ( string  str,
int  quality = BROTLI_DEFAULT_QUALITY 
)

Compresses the given data with the Brotli algorithm (RFC 7932) and returns the compressed data as a binary.

Strings are compressed without the trailing null character

Parameters
strthe data to compress
qualitythe compression quality level, must be a value between 0 and 11 inclusive, 0 = the least compression (and fastest), 11 = the most compression (using the most memory and time). An invalid option passed to this argument will result in a BROTLI-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = brotli(str);
Exceptions
BROTLI-LEVEL-ERRORquality must be between 0 - 11 or -1
BROTLI-ERRORthe Brotli library returned an error during processing
Since
Qore 2.1

◆ bunzip2_to_binary() [1/2]

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

◆ bunzip2_to_binary() [2/2]

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:
binary bin = bunzip2_to_binary(bzip2_string);
Exceptions
BZIP2-DECOMPRESS-ERRORthe bzip2 library returned an internal error during processing (possibly due to corrupt input data)

◆ bunzip2_to_string() [1/2]

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

◆ bunzip2_to_string() [2/2]

string Qore::bunzip2_to_string ( binary  bin,
__7_ 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:
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)

◆ bzip2() [1/3]

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

◆ bzip2() [2/3]

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:
binary bin = bzip2(data);
Exceptions
BZLIB2-LEVEL-ERRORlevel must be between 1 - 9
BZIP2-COMPRESS-ERRORthe bzip2 library returned an error during processing

◆ bzip2() [3/3]

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:
binary bin = bzip2(str);
Exceptions
BZLIB2-LEVEL-ERRORlevel must be between 1 - 9
BZIP2-COMPRESS-ERRORthe bzip2 library returned an error during processing

◆ compress() [1/3]

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

◆ compress() [2/3]

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:
binary bin = compress(bin_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing

◆ compress() [3/3]

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:
binary bin = compress(str_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing

◆ deflate_raw() [1/3]

nothing Qore::deflate_raw ( )

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

◆ deflate_raw() [2/3]

binary Qore::deflate_raw ( binary  bin,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs raw DEFLATE compression without zlib/gzip headers or trailers.

This is the raw DEFLATE format as specified in RFC 1951, without the zlib header/trailer from RFC 1950 or gzip header/trailer from RFC 1952.

This is used by the WebSocket permessage-deflate extension (RFC 7692).

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 in raw DEFLATE format
Example:
binary bin = deflate_raw(bin_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing
Since
Qore 2.3

◆ deflate_raw() [3/3]

binary Qore::deflate_raw ( string  str,
int  level = Z_DEFAULT_COMPRESSION 
)

Performs raw DEFLATE compression without zlib/gzip headers or trailers.

This is the raw DEFLATE format as specified in RFC 1951, without the zlib header/trailer from RFC 1950 or gzip header/trailer from RFC 1952.

This is used by the WebSocket permessage-deflate extension (RFC 7692).

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 in raw DEFLATE format
Example:
binary bin = deflate_raw(str_data);
Exceptions
ZLIB-LEVEL-ERRORlevel must be between 1 - 9 or -1
ZLIB-ERRORzlib returned an error while processing
Since
Qore 2.3

◆ get_compressor()

Transform Qore::get_compressor ( string  alg,
int  level = COMPRESSION_LEVEL_DEFAULT 
)

Returns a Transform object for compressing data using the given algorithm for use with TransformInputStream and TransformOutputStream.

Example:
Qore::FileOutputStream of("my-file.txt.bz2");
Qore::TransformOutputStream ts(of, get_compressor(Qore::COMPRESSION_ALG_BZIP2));
Parameters
algthe transformation algorithm; see Compression Stream Transformations for possible values
levelcompression level as defined by the algorithm or COMPRESSION_LEVEL_DEFAULT to use the default compression level
Returns
a Transform object for compressing data using the given algorithm for use with TransformInputStream and TransformOutputStream
See also
Qore::get_decompressor()
Since
Qore 0.8.13

◆ get_decompressor()

Transform Qore::get_decompressor ( string  alg)

Returns a Transform object for decompressing data using the given algorithm for use with TransformInputStream and TransformOutputStream.

Example:
Qore::FileOutputStream of("my-file.txt.bz2");
Qore::TransformOutputStream ts(of, get_decompressor(Qore::COMPRESSION_ALG_BZIP2));
Parameters
algthe transformation algorithm; see Compression Stream Transformations for possible values
Returns
a Transform object for decompressing data using the given algorithm for use with TransformInputStream and TransformOutputStream
See also
Qore::get_compressor()
Since
Qore 0.8.13

◆ gunzip_to_binary() [1/2]

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

◆ gunzip_to_binary() [2/2]

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:
binary bin = gunzip_to_binary(data);
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)

◆ gunzip_to_string() [1/2]

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

◆ gunzip_to_string() [2/2]

string Qore::gunzip_to_string ( binary  bin,
__7_ 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:
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)

◆ gzip() [1/3]

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

◆ gzip() [2/3]

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:
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)

◆ gzip() [3/3]

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:
binary data = gzip(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)

◆ inflate_raw_to_binary() [1/2]

nothing Qore::inflate_raw_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

◆ inflate_raw_to_binary() [2/2]

binary Qore::inflate_raw_to_binary ( binary  bin)

Performs raw DEFLATE decompression and returns a binary object of the decompressed data.

This decompresses data in raw DEFLATE format as specified in RFC 1951, without the zlib header/trailer from RFC 1950 or gzip header/trailer from RFC 1952.

This is used by the WebSocket permessage-deflate extension (RFC 7692).

Parameters
binthe compressed data to decompress (in raw DEFLATE format)
Returns
the uncompressed data as a binary object
Example:
binary bin = inflate_raw_to_binary(data);
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
Since
Qore 2.3

◆ inflate_raw_to_string() [1/2]

nothing Qore::inflate_raw_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

◆ inflate_raw_to_string() [2/2]

string Qore::inflate_raw_to_string ( binary  bin,
__7_ string  encoding 
)

Performs raw DEFLATE decompression and returns a string of the decompressed data.

This decompresses data in raw DEFLATE format as specified in RFC 1951, without the zlib header/trailer from RFC 1950 or gzip header/trailer from RFC 1952.

This is used by the WebSocket permessage-deflate extension (RFC 7692).

Parameters
binthe compressed data to decompress (in raw DEFLATE format)
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:
string str = inflate_raw_to_string(bin, "utf-8");
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)
Since
Qore 2.3

◆ lz4() [1/3]

nothing Qore::lz4 ( )

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
Since
Qore 2.1

◆ lz4() [2/3]

binary Qore::lz4 ( binary  bin,
int  acceleration = 1 
)

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

Note
LZ4 does not store the original size in the compressed data, so decompression requires either a max_output_size parameter or knowledge of the original size.
Parameters
binthe data to compress
accelerationthe acceleration factor for faster compression at the cost of compression ratio, must be a value between 1 and 65537 inclusive, 1 = best compression ratio (default), higher values = faster compression but larger output. An invalid option passed to this argument will result in a LZ4-ACCELERATION-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = lz4(data);
Exceptions
LZ4-ACCELERATION-ERRORacceleration must be between 1 - 65537
LZ4-ERRORthe LZ4 library returned an error during processing
Since
Qore 2.1

◆ lz4() [3/3]

binary Qore::lz4 ( string  str,
int  acceleration = 1 
)

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

Strings are compressed without the trailing null character.

Note
LZ4 does not store the original size in the compressed data, so decompression requires either a max_output_size parameter or knowledge of the original size.
Parameters
strthe data to compress
accelerationthe acceleration factor for faster compression at the cost of compression ratio, must be a value between 1 and 65537 inclusive, 1 = best compression ratio (default), higher values = faster compression but larger output. An invalid option passed to this argument will result in a LZ4-ACCELERATION-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = lz4(str);
Exceptions
LZ4-ACCELERATION-ERRORacceleration must be between 1 - 65537
LZ4-ERRORthe LZ4 library returned an error during processing
Since
Qore 2.1

◆ unbrotli_to_binary() [1/2]

nothing Qore::unbrotli_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
Since
Qore 2.1

◆ unbrotli_to_binary() [2/2]

binary Qore::unbrotli_to_binary ( binary  bin)

Decompresses the given data with the Brotli algorithm (RFC 7932) and returns the decompressed data as a binary object.

Parameters
binthe compressed data to decompress
Returns
the uncompressed data as a binary object
Example:
binary bin = unbrotli_to_binary(brotli_data);
Exceptions
BROTLI-ERRORthe Brotli library returned an internal error during processing (possibly due to corrupt input data)
Since
Qore 2.1

◆ unbrotli_to_string() [1/2]

nothing Qore::unbrotli_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
Since
Qore 2.1

◆ unbrotli_to_string() [2/2]

string Qore::unbrotli_to_string ( binary  bin,
__7_ string  encoding 
)

Decompresses the given data with the Brotli algorithm (RFC 7932) and returns the decompressed 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:
string str = unbrotli_to_string(brotli_data, "utf-8");
Exceptions
BROTLI-ERRORthe Brotli library returned an internal error during processing (possibly due to corrupt input data)
Since
Qore 2.1

◆ uncompress_to_binary() [1/2]

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

◆ uncompress_to_binary() [2/2]

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:
binary bin = uncompress_to_binary(data);
Exceptions
ZLIB-ERRORThe zlib library returned an error during processing (possibly due to corrupt input data)

◆ uncompress_to_string() [1/2]

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

◆ uncompress_to_string() [2/2]

string Qore::uncompress_to_string ( binary  bin,
__7_ 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:
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)

◆ unlz4_to_binary() [1/2]

nothing Qore::unlz4_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
Since
Qore 2.1

◆ unlz4_to_binary() [2/2]

binary Qore::unlz4_to_binary ( binary  bin,
int  max_output_size = 0 
)

Decompresses the given data with the LZ4 algorithm and returns the decompressed data as a binary object.

Note
LZ4 does not store the original size in the compressed data, so either max_output_size must be provided, or it will be estimated (which may fail for highly compressed data).
Parameters
binthe compressed data to decompress
max_output_sizethe maximum size of the decompressed output (default: 0 = estimate from input size)
Returns
the uncompressed data as a binary object
Example:
binary bin = unlz4_to_binary(lz4_data, 1000000);
Exceptions
LZ4-ERRORthe LZ4 library returned an internal error during processing (possibly due to corrupt input data or buffer too small)
Since
Qore 2.1

◆ unlz4_to_string() [1/2]

nothing Qore::unlz4_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
Since
Qore 2.1

◆ unlz4_to_string() [2/2]

string Qore::unlz4_to_string ( binary  bin,
int  max_output_size = 0,
__7_ string  encoding 
)

Decompresses the given data with the LZ4 algorithm and returns the decompressed data as a string.

Note
LZ4 does not store the original size in the compressed data, so either max_output_size must be provided, or it will be estimated (which may fail for highly compressed data).
Parameters
binthe compressed data to decompress
max_output_sizethe maximum size of the decompressed output (default: 0 = estimate from input size)
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:
string str = unlz4_to_string(lz4_data, 1000000, "utf-8");
Exceptions
LZ4-ERRORthe LZ4 library returned an internal error during processing (possibly due to corrupt input data or buffer too small)
Since
Qore 2.1

◆ unzstd_to_binary() [1/2]

nothing Qore::unzstd_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
Since
Qore 2.1

◆ unzstd_to_binary() [2/2]

binary Qore::unzstd_to_binary ( binary  bin)

Decompresses the given data with the Zstandard algorithm (RFC 8878) and returns the decompressed data as a binary object.

Parameters
binthe compressed data to decompress
Returns
the uncompressed data as a binary object
Example:
binary bin = unzstd_to_binary(zstd_data);
Exceptions
ZSTD-ERRORthe Zstd library returned an internal error during processing (possibly due to corrupt input data)
Since
Qore 2.1

◆ unzstd_to_string() [1/2]

nothing Qore::unzstd_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
Since
Qore 2.1

◆ unzstd_to_string() [2/2]

string Qore::unzstd_to_string ( binary  bin,
__7_ string  encoding 
)

Decompresses the given data with the Zstandard algorithm (RFC 8878) and returns the decompressed 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:
string str = unzstd_to_string(zstd_data, "utf-8");
Exceptions
ZSTD-ERRORthe Zstd library returned an internal error during processing (possibly due to corrupt input data)
Since
Qore 2.1

◆ zstd() [1/3]

nothing Qore::zstd ( )

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
Since
Qore 2.1

◆ zstd() [2/3]

binary Qore::zstd ( binary  bin,
int  level = 3 
)

Compresses the given data with the Zstandard algorithm (RFC 8878) and returns the compressed data as a binary.

Parameters
binthe data to compress
levelthe compression level, must be a value between 1 and ZSTD_MAX_LEVEL (typically 22) inclusive, 1 = the least compression (and fastest), ZSTD_MAX_LEVEL = the most compression (using the most memory and time). An invalid option passed to this argument will result in a ZSTD-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = zstd(data);
Exceptions
ZSTD-LEVEL-ERRORlevel must be between 1 - ZSTD_MAX_LEVEL or -1
ZSTD-ERRORthe Zstd library returned an error during processing
Since
Qore 2.1

◆ zstd() [3/3]

binary Qore::zstd ( string  str,
int  level = 3 
)

Compresses the given data with the Zstandard algorithm (RFC 8878) 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 ZSTD_MAX_LEVEL (typically 22) inclusive, 1 = the least compression (and fastest), ZSTD_MAX_LEVEL = the most compression (using the most memory and time). An invalid option passed to this argument will result in a ZSTD-LEVEL-ERROR exception being raised.
Returns
the compressed data as a binary object
Example:
binary bin = zstd(str);
Exceptions
ZSTD-LEVEL-ERRORlevel must be between 1 - ZSTD_MAX_LEVEL or -1
ZSTD-ERRORthe Zstd library returned an error during processing
Since
Qore 2.1