Chilkat VB.NET Compression Class Reference

Compression

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

(C#)
Chilkat.Compression obj = new Chilkat.Compression();
(VB.NET)
Dim obj As New Chilkat.Compression()

Properties

Algorithm As String

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

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.

EnableEvents As Boolean

This property must be set to true to enable events. By default, it is false.

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 (ReadOnly)

Error information in HTML format for the last method called.

LastErrorText As String (ReadOnly)

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

LastErrorXml As String (ReadOnly)

Error information in XML format for the last method called.

Version As String (ReadOnly)

A version string, such as "1.2.0"

Methods

Function BeginCompressBytes(ByVal data As Byte()) As Byte()

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 Nothing on failure

Function BeginCompressBytesENC(ByVal data As Byte()) 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 Nothing on failure

Function BeginCompressString(ByVal str As String) As Byte()

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 Nothing on failure

Function BeginCompressStringENC(ByVal 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 Nothing on failure

Function BeginDecompressBytes(ByVal data As Byte()) As Byte()

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 Nothing on failure

Function BeginDecompressBytesENC(ByVal str As String) As Byte()

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 Nothing on failure

Function BeginDecompressString(ByVal data As Byte()) 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 Nothing on failure

Function BeginDecompressStringENC(ByVal 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 Nothing on failure

Function CompressBytes(ByVal data As Byte()) As Byte()

Compresses byte data.

Returns the compressed data in a byte array.

Returns Nothing on failure

Function CompressBytesENC(ByVal data As Byte()) 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 Nothing on failure

Function CompressFile(ByVal inFile As String, ByVal outFile As String) As Boolean

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

Function CompressString(ByVal str As String) As Byte()

Compresses a string.

Returns the compressed data in a byte array.

Returns Nothing on failure

Function CompressStringENC(ByVal 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 Nothing on failure

Function DecompressBytes(ByVal data As Byte()) As Byte()

The opposite of CompressBytes.

Returns Nothing on failure

Function DecompressBytesENC(ByVal encodedCompressedData As String) As Byte()

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 byte array.

Returns Nothing on failure

Function DecompressFile(ByVal inFile As String, ByVal outFile As String) As Boolean

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.

Function DecompressString(ByVal data As Byte()) As String

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

Returns Nothing on failure

Function DecompressStringENC(ByVal 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 Nothing on failure

Function EndCompressBytes() As Byte()

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

(See BeginCompressBytes)

Returns Nothing on failure

Function EndCompressBytesENC() As String

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

(See BeginCompressBytesENC)

Returns Nothing on failure

Function EndCompressString() As Byte()

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

(See BeginCompressString)

Returns Nothing on failure

Function EndCompressStringENC() As String

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

(See BeginCompressStringENC)

Returns Nothing on failure

Function EndDecompressBytes() As Byte()

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

(See BeginDecompressBytes)

Returns Nothing on failure

Function EndDecompressBytesENC() As Byte()

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 Nothing on failure

Function EndDecompressString() As String

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

(See BeginDecompressString)

Returns Nothing on failure

Function 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 Nothing on failure

Function MoreCompressBytes(ByVal data As Byte()) As Byte()

(See BeginCompressBytes)

Returns Nothing on failure

Function MoreCompressBytesENC(ByVal data As Byte()) As String

(See BeginCompressBytesENC)

Returns Nothing on failure

Function MoreCompressString(ByVal str As String) As Byte()

(See BeginCompressString)

Returns Nothing on failure

Function MoreCompressStringENC(ByVal str As String) As String

(See BeginCompressStringENC)

Returns Nothing on failure

Function MoreDecompressBytes(ByVal data As Byte()) As Byte()

(See BeginDecompressBytes)

Returns Nothing on failure

Function MoreDecompressBytesENC(ByVal str As String) As Byte()

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 Nothing on failure

Function MoreDecompressString(ByVal data As Byte()) As String

(See BeginDecompressString)

Returns Nothing on failure

Function MoreDecompressStringENC(ByVal 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 Nothing on failure

Function SaveLastError(ByVal filename As String) As Boolean

Saves the last error information to an XML formatted file.

Function UnlockComponent(ByVal unlockCode As String) As Boolean

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.