ChilkatCompression ActiveX Reference

ChilkatCompression

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.

Object Creation

(Visual Basic 6.0)
Dim obj As New ChilkatCompression
(ASP)
set obj = Server.CreateObject("Chilkat.Compression")
(VBScript)
set obj = CreateObject("Chilkat.Compression")
(Delphi)
obj := TChilkatCompression.Create(Self);
(FoxPro)
loObject = CreateObject('Chilkat.Compression')
(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.Compression', @obj OUT
(Javascript)
var obj = new ActiveXObject("Chilkat.Compression");

Properties

Algorithm As String

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

Note: The PPMD compression algorithm is only available for Windows OS builds. It is not yet available on non-Windows platforms.

Charset As String

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.

EncodingMode As String

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.

LastErrorHtml As String (read-only)

Error information in HTML format for the last method called.

LastErrorText As String (read-only)

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

LastErrorXml As String (read-only)

Error information in XML format for the last method called.

Version As String (read-only)

A version string, such as "1.2.0"

Methods

BeginCompressBytes(data As Variant) As Variant

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

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

BeginCompressBytesENC(data As Variant) As String

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 a null on failure

BeginCompressString(str As String) As Variant

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

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

BeginCompressStringENC(str As String) As String

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 a null on failure

BeginDecompressBytes(data As Variant) As Variant

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.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

BeginDecompressBytesENC(str As String) As Variant

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.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

BeginDecompressString(data As Variant) As String

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 a null on failure

BeginDecompressStringENC(str As String) As String

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 a null on failure

CompressBytes(data As Variant) As Variant

Compresses byte data.

Returns the compressed data as a Variant containing a byte array.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

CompressBytesENC(data As Variant) As String

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

Returns a null on failure

CompressFile(inFile As String, outFile As String) As Long

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

CompressString(str As String) As Variant

Compresses a string.

Returns the compressed data as a Variant containing a byte array.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

CompressStringENC(str As String) As String

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 a null on failure

DecompressBytes(data As Variant) As Variant

The opposite of CompressBytes.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

DecompressBytesENC(encodedCompressedData As String) As Variant

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 as a Variant containing a byte array.

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

DecompressFile(inFile As String, outFile As String) As Long

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.

DecompressString(data As Variant) As String

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

Returns a null on failure

DecompressStringENC(encodedCompressedData As String) As String

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

Returns a null on failure

EndCompressBytes() As Variant

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

(See BeginCompressBytes)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

EndCompressBytesENC() As String

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

(See BeginCompressBytesENC)

Returns a null on failure

EndCompressString() As Variant

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

(See BeginCompressString)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

EndCompressStringENC() As String

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

(See BeginCompressStringENC)

Returns a null on failure

EndDecompressBytes() As Variant

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

(See BeginDecompressBytes)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

EndDecompressBytesENC() As Variant

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)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

EndDecompressString() As String

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

(See BeginDecompressString)

Returns a null on failure

EndDecompressStringENC() As String

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 a null on failure

MoreCompressBytes(data As Variant) As Variant

(See BeginCompressBytes)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

MoreCompressBytesENC(data As Variant) As String

(See BeginCompressBytesENC)

Returns a null on failure

MoreCompressString(str As String) As Variant

(See BeginCompressString)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

MoreCompressStringENC(str As String) As String

(See BeginCompressStringENC)

Returns a null on failure

MoreDecompressBytes(data As Variant) As Variant

(See BeginDecompressBytes)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

MoreDecompressBytesENC(str As String) As Variant

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)

Returns a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

MoreDecompressString(data As Variant) As String

(See BeginDecompressString)

Returns a null on failure

MoreDecompressStringENC(str As String) As String

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 a null on failure

SaveLastError(logFilename As String) As Long

Saves the last error information to an XML formatted file.

UnlockComponent(unlockCode As String) As Long

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.