CkCompression C++ Class Reference (Visual C++)

CkCompression

Data compression component implementing the PPMD, Bzip2, Deflate, and LZW compression algorithms. .NET, ActiveX, and C++ implementations provide progress monitoring and abort capabilities. Provides a unified API for all supported compression algorithms.

Properties

void get_Algorithm(CkString &out);
void put_Algorithm(const char *alg);

The compression algorithm to be used. Should be set to either "ppmd", "deflate", "bzip2", or "lzw".

void get_Charset(CkString &str);
void put_Charset(const char *newVal);

Only applies to methods that compress or decompress strings. This specifies the character encoding that the string should be converted to before compression. Many programming languages use Unicode (2 bytes per char) for representing characters. This property allows for the string to be converted to a 1-byte per char encoding prior to compression.

void get_EncodingMode(CkString &str);
void put_EncodingMode(const char *newVal);

Controls the encoding expected by methods ending in "ENC", such as CompressBytesENC. Valid values are "base64", "hex", "url", and "quoted-printable". Compression methods ending in ENC return the binary compressed data as an encoded string using this encoding. Decompress methods expect the input string to be this encoding.

void LastErrorHtml(CkString &str);

Error information in HTML format for the last method called.

void LastErrorText(CkString &str);

Error information in plain-text format for the last method called.

void LastErrorXml(CkString &str);

Error information in XML format for the last method called.

bool get_Utf8(void) const;
void put_Utf8(bool b);

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

void get_Version(CkString &str);

A version string, such as "1.2.0"

Methods

bool BeginCompressBytes(const CkByteData & bData, CkByteData & out);

Large amounts of binary byte data may be compressed in chunks by first calling BeginCompressBytes, followed by 0 or more calls to MoreCompressedBytes, and ending with a final call to EndCompressBytes. Each call returns 0 or more bytes of compressed data which may be output to a compressed data stream (such as a file, socket, etc.).

bool BeginCompressBytesENC(const CkByteData & bData, CkString & out);

Large amounts of binary byte data may be compressed in chunks by first calling BeginCompressBytesENC, followed by 0 or more calls to MoreCompressedBytesENC, and ending with a final call to EndCompressBytesENC. Each call returns 0 or more characters of compressed data (encoded as a string according to the EncodingMode property setting) which may be output to a compressed data stream (such as a file, socket, etc.).

Returns true for success, false for failure.

bool BeginCompressString(const char * str, CkByteData & out);

Large amounts of string data may be compressed in chunks by first calling BeginCompressString, followed by 0 or more calls to MoreCompressedString, and ending with a final call to EndCompressString. Each call returns 0 or more bytes of compressed data which may be output to a compressed data stream (such as a file, socket, etc.).

bool BeginCompressStringENC(const char * str, CkString & out);

Large amounts of string data may be compressed in chunks by first calling BeginCompressStringENC, followed by 0 or more calls to MoreCompressedStringENC, and ending with a final call to EndCompressStringENC. Each call returns 0 or more characters of compressed data (encoded as a string according to the EncodingMode property setting) which may be output to a compressed data stream (such as a file, socket, etc.).

Returns true for success, false for failure.

bool BeginDecompressBytes(const CkByteData & bData, CkByteData & out);

A compressed data stream may be decompressed in chunks by first calling BeginDecompressBytes, followed by 0 or more calls to MoreDecompressedBytes, and ending with a final call to EndDecompressBytes. Each call returns 0 or more bytes of decompressed data.

bool BeginDecompressBytesENC(const char * str, CkByteData & out);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

A compressed data stream may be decompressed in chunks by first calling BeginDecompressBytesENC, followed by 0 or more calls to MoreDecompressedBytesENC, and ending with a final call to EndDecompressBytesENC. Each call returns 0 or more bytes of decompressed data.

bool BeginDecompressString(const CkByteData & bData, CkString & out);

A compressed data stream may be decompressed in chunks by first calling BeginDecompressString, followed by 0 or more calls to MoreDecompressedString, and ending with a final call to EndDecompressString. Each call returns 0 or more characters of decompressed text.

Returns true for success, false for failure.

bool BeginDecompressStringENC(const char * str, CkString & out);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

A compressed data stream may be decompressed in chunks by first calling BeginDecompressStringENC, followed by 0 or more calls to MoreDecompressedStringENC, and ending with a final call to EndDecompressStringENC. Each call returns 0 or more characters of decompressed text.

Returns true for success, false for failure.

bool CompressBytes(const CkByteData & bData, CkByteData & out);

Compresses byte data.

Returns the compressed data in a CkByteData object.

bool CompressBytesENC(const CkByteData & bData, CkString & out);

Compresses bytes and returns the compressed data encoded to a string. The encoding (hex, base64, etc.) is determined by the EncodingMode property setting.

Returns true for success, false for failure.

bool CompressFile(const char * inFile, const char * outFile);

Performs file-to-file compression. Files of any size may be compressed because the file is compressed internally in streaming mode.

bool CompressString(const char * str, CkByteData & out);

Compresses a string.

Returns the compressed data in a CkByteData object.

bool CompressStringENC(const char * str, CkString & out);

Compresses a string and returns the compressed data encoded to a string. The output encoding (hex, base64, etc.) is determined by the EncodingMode property setting.

Returns true for success, false for failure.

bool DecompressBytes(const CkByteData & bData, CkByteData & out);

The opposite of CompressBytes.

bool DecompressBytesENC(const char * encodedCompressedData, CkByteData & out);

The opposite of CompressBytesENC. encodedCompressedData contains the compressed data as an encoded string (hex, base64, etc) as specified by the EncodingMode property setting.

Returns the decompressed data in a CkByteData object.

bool DecompressFile(const char * inFile, const char * outFile);

Performs file-to-file decompression (the opposite of CompressFile). Internally the file is decompressed in streaming mode which allows files of any size to be decompressed.

bool DecompressString(const CkByteData & bData, CkString & out);

Takes compressed bytes, decompresses, and returns the resulting string.

Returns true for success, false for failure.

bool DecompressStringENC(const char * encodedCompressedData, CkString & out);

The opposite of CompressStringENC. encodedCompressedData contains the compressed data as an encoded string (hex, base64, etc) as specified by the EncodingMode property setting.

Returns true for success, false for failure.

bool EndCompressBytes(CkByteData & out);

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressBytes)

bool EndCompressBytesENC(CkString & out);

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressBytesENC)

Returns true for success, false for failure.

bool EndCompressString(CkByteData & out);

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressString)

bool EndCompressStringENC(CkString & out);

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressStringENC)

Returns true for success, false for failure.

bool EndDecompressBytes(CkByteData & out);

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

(See BeginDecompressBytes)

bool EndDecompressBytesENC(CkByteData & out);

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressBytesENC)

bool EndDecompressString(CkString & out);

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

(See BeginDecompressString)

Returns true for success, false for failure.

bool EndDecompressStringENC(CkString & out);

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressStringENC)

Returns true for success, false for failure.

bool MoreCompressBytes(const CkByteData & bData, CkByteData & out);

(See BeginCompressBytes)

bool MoreCompressBytesENC(const CkByteData & bData, CkString & out);

(See BeginCompressBytesENC)

Returns true for success, false for failure.

bool MoreCompressString(const char * str, CkByteData & out);

(See BeginCompressString)

bool MoreCompressStringENC(const char * str, CkString & out);

(See BeginCompressStringENC)

Returns true for success, false for failure.

bool MoreDecompressBytes(const CkByteData & bData, CkByteData & out);

(See BeginDecompressBytes)

bool MoreDecompressBytesENC(const char * str, CkByteData & out);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressBytesENC)

bool MoreDecompressString(const CkByteData & bData, CkString & out);

(See BeginDecompressString)

Returns true for success, false for failure.

bool MoreDecompressStringENC(const char * str, CkString & out);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressStringENC)

Returns true for success, false for failure.

bool SaveLastError(const char * filename);

Saves the last error information to an XML formatted file.

bool UnlockComponent(const char * unlockCode);

Unlocks the component allowing for the full functionality to be used. The component may be used fully-functional for the 1st 30-days after download by passing an arbitrary string to this method. If for some reason you do not receive the full 30-day trial, send email to support@chilkatsoft.com for a temporary unlock code w/ an explicit expiration date. Upon purchase, a permanent unlock code is provided which should replace the temporary/arbitrary string passed to this method.

const char * algorithm();

The compression algorithm to be used. Should be set to either "ppmd", "deflate", "bzip2", or "lzw".

const char * beginCompressBytesENC(const CkByteData & bData);

Large amounts of binary byte data may be compressed in chunks by first calling BeginCompressBytesENC, followed by 0 or more calls to MoreCompressedBytesENC, and ending with a final call to EndCompressBytesENC. Each call returns 0 or more characters of compressed data (encoded as a string according to the EncodingMode property setting) which may be output to a compressed data stream (such as a file, socket, etc.).

const char * beginCompressStringENC(const char * str);

Large amounts of string data may be compressed in chunks by first calling BeginCompressStringENC, followed by 0 or more calls to MoreCompressedStringENC, and ending with a final call to EndCompressStringENC. Each call returns 0 or more characters of compressed data (encoded as a string according to the EncodingMode property setting) which may be output to a compressed data stream (such as a file, socket, etc.).

const char * beginDecompressString(const CkByteData & bData);

A compressed data stream may be decompressed in chunks by first calling BeginDecompressString, followed by 0 or more calls to MoreDecompressedString, and ending with a final call to EndDecompressString. Each call returns 0 or more characters of decompressed text.

const char * beginDecompressStringENC(const char * str);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

A compressed data stream may be decompressed in chunks by first calling BeginDecompressStringENC, followed by 0 or more calls to MoreDecompressedStringENC, and ending with a final call to EndDecompressStringENC. Each call returns 0 or more characters of decompressed text.

const char * charset();

Only applies to methods that compress or decompress strings. This specifies the character encoding that the string should be converted to before compression. Many programming languages use Unicode (2 bytes per char) for representing characters. This property allows for the string to be converted to a 1-byte per char encoding prior to compression.

const char * compressBytesENC(const CkByteData & bData);

Compresses bytes and returns the compressed data encoded to a string. The encoding (hex, base64, etc.) is determined by the EncodingMode property setting.

const char * compressStringENC(const char * str);

Compresses a string and returns the compressed data encoded to a string. The output encoding (hex, base64, etc.) is determined by the EncodingMode property setting.

const char * decompressString(const CkByteData & bData);

Takes compressed bytes, decompresses, and returns the resulting string.

const char * decompressStringENC(const char * encodedCompressedData);

The opposite of CompressStringENC. encodedCompressedData contains the compressed data as an encoded string (hex, base64, etc) as specified by the EncodingMode property setting.

const char * encodingMode();

Controls the encoding expected by methods ending in "ENC", such as CompressBytesENC. Valid values are "base64", "hex", "url", and "quoted-printable". Compression methods ending in ENC return the binary compressed data as an encoded string using this encoding. Decompress methods expect the input string to be this encoding.

const char * endCompressBytesENC();

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressBytesENC)

const char * endCompressStringENC();

Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.

(See BeginCompressStringENC)

const char * endDecompressString();

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

(See BeginDecompressString)

const char * endDecompressStringENC();

Called to finalize the decompression stream and return any remaining (buffered) decompressed data.

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressStringENC)

const char * lastErrorHtml();

Error information in HTML format for the last method called.

const char * lastErrorText();

Error information in plain-text format for the last method called.

const char * lastErrorXml();

Error information in XML format for the last method called.

const char * moreCompressBytesENC(const CkByteData & bData);

(See BeginCompressBytesENC)

const char * moreCompressStringENC(const char * str);

(See BeginCompressStringENC)

const char * moreDecompressString(const CkByteData & bData);

(See BeginDecompressString)

const char * moreDecompressStringENC(const char * str);

The input to this method is an encoded string containing compressed data. The EncodingMode property should be set prior to calling this method. The input string is decoded according to the EncodingMode (hex, base64, etc.) and then decompressed.

(See BeginDecompressStringENC)

const char * version();

A version string, such as "1.2.0"