All Classes Namespaces Functions Variables Groups Pages
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.
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, *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::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, *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::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, *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.

## 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

  bin | the compressed data to decompress

Returns
  the uncompressed data as a binary object

Example:
  my string $str = bunzip2_to_binary($bzip2_string);

Exceptions

  BZIP2-DECOMPRESS-ERROR | the 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

  bin | the compressed data to decompress
  encoding | the 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-ERROR | the 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

  bin | the data to compress
  level | the 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-ERROR | level must be between 1 - 9
  BZIP2-COMPRESS-ERROR | the 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

  str | the data to compress
  level | the 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-ERROR | level must be between 1 - 9
  BZIP2-COMPRESS-ERROR | the 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

  str | The string to compress
  level | Specifies 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-ERROR | level must be between 1 - 9 or -1
  ZLIB-ERROR | zlib 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

  bin | The binary object to compress
  level | Specifies 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-ERROR | level must be between 1 - 9 or -1
  ZLIB-ERROR | zlib 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

  bin | the compressed data to decompress

Returns
  the uncompressed data as a binary object

Example:
  my binary $bin = gunzip_to_string($data);

Exceptions

  ZLIB-ERROR | The 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

  bin | the compressed data to decompress
  encoding | the 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-ERROR | The 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

  str | the data to compress
  level | the 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-ERROR | level must be between 1 - 9 or -1
  ZLIB-ERROR | The 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

  bin | the data to compress
  level | the 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-ERROR | level must be between 1 - 9 or -1
  ZLIB-ERROR | The 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

  bin | the data to decompress

Returns
  a binary object of the decompressed data

Example:
  my binary $bin = uncompress_to_binary($data);

Exceptions

  ZLIB-ERROR | The 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

  bin | the compressed data to decompress
  encoding | the 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-ERROR | The 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