Chilkat C# 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
public string Algorithm {get; set; }
The compression algorithm to be used. Should be set to either "ppmd", "deflate", "bzip2", or "lzw".
public string Charset {get; set; }
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.
public bool EnableEvents {get; set; }
This property must be set to true to enable events. By default, it is false.
public string EncodingMode {get; set; }
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.
public string LastErrorHtml {get; }
Error information in HTML format for the last method called.
public string LastErrorText {get; }
Error information in plain-text format for the last method called.
public string LastErrorXml {get; }
Error information in XML format for the last method called.
public string Version {get; }
A version string, such as "1.2.0"
Methods
public byte[] BeginCompressBytes(byte[] data);
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 null on failure
public string BeginCompressBytesENC(byte[] data);
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
public byte[] BeginCompressString(string str);
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 null on failure
public string BeginCompressStringENC(string 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.). Returns a null on failure
public byte[] BeginDecompressBytes(byte[] data);
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 null on failure
public byte[] BeginDecompressBytesENC(string 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 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 null on failure
public string BeginDecompressString(byte[] data);
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
public string BeginDecompressStringENC(string 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. Returns a null on failure
public byte[] CompressBytes(byte[] data);
Compresses byte data. Returns the compressed data in a byte array. Returns null on failure
public string CompressBytesENC(byte[] data);
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
public bool CompressFile(string inFile, string outFile);
Performs file-to-file compression. Files of any size may be compressed because the file is compressed internally in streaming mode.
public byte[] CompressString(string str);
Compresses a string. Returns the compressed data in a byte array. Returns null on failure
public string CompressStringENC(string 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. Returns a null on failure
public byte[] DecompressBytes(byte[] data);
The opposite of CompressBytes. Returns null on failure
public byte[] DecompressBytesENC(string encodedCompressedData);
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 null on failure
public bool DecompressFile(string inFile, string 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.
public string DecompressString(byte[] data);
Takes compressed bytes, decompresses, and returns the resulting string. Returns a null on failure
public string DecompressStringENC(string encodedCompressedData);
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
public byte[] EndCompressBytes();
Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.
(See BeginCompressBytes) Returns null on failure
public string EndCompressBytesENC();
Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.
(See BeginCompressBytesENC) Returns a null on failure
public byte[] EndCompressString();
Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.
(See BeginCompressString) Returns null on failure
public string EndCompressStringENC();
Must be callled to finalize a compression stream. Returns any remaining (buffered) compressed data.
(See BeginCompressStringENC) Returns a null on failure
public byte[] EndDecompressBytes();
Called to finalize the decompression stream and return any remaining (buffered) decompressed data.
(See BeginDecompressBytes) Returns null on failure
public byte[] EndDecompressBytesENC();
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 null on failure
public string EndDecompressString();
Called to finalize the decompression stream and return any remaining (buffered) decompressed data.
(See BeginDecompressString) Returns a null on failure
public string 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) Returns a null on failure
public byte[] MoreCompressBytes(byte[] data);
(See BeginCompressBytes) Returns null on failure
public string MoreCompressBytesENC(byte[] data);
(See BeginCompressBytesENC) Returns a null on failure
public byte[] MoreCompressString(string str);
(See BeginCompressString) Returns null on failure
public string MoreCompressStringENC(string str);
(See BeginCompressStringENC) Returns a null on failure
public byte[] MoreDecompressBytes(byte[] data);
(See BeginDecompressBytes) Returns null on failure
public byte[] MoreDecompressBytesENC(string 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 BeginDecompressBytesENC) Returns null on failure
public string MoreDecompressString(byte[] data);
(See BeginDecompressString) Returns a null on failure
public string MoreDecompressStringENC(string 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) Returns a null on failure
public bool SaveLastError(string filename);
Saves the last error information to an XML formatted file.
public bool UnlockComponent(string 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.
|