UnixCompress C Library Reference

UnixCompress

UNIX (.Z) compression C library.

Create/Dispose

HCkUnixCompress CkUnixCompress_Create(void);

Creates an instance of the CkUnixCompress object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkUnixCompress_Dispose(HCkUnixCompress handle);

Objects created by calling CkUnixCompress_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

C "Properties"

void CkUnixCompress_getLastErrorHtml(HCkUnixCompress handle, HCkString retval);

Error information in HTML format for the last method called.

void CkUnixCompress_getLastErrorText(HCkUnixCompress handle, HCkString retval);

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

void CkUnixCompress_getLastErrorXml(HCkUnixCompress handle, HCkString retval);

Error information in XML format for the last method called.

BOOL CkUnixCompress_getUtf8(HCkUnixCompress handle);
void CkUnixCompress_putUtf8(HCkUnixCompress handle, BOOL newVal);

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.

C "Methods"

BOOL CkUnixCompress_CompressFile(HCkUnixCompress handle, const char *inFilename, const char *outFilename);

Compresses a file to create a UNIX compressed file (.Z). This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.

Returns TRUE for success, FALSE for failure.

BOOL CkUnixCompress_CompressFileToMem(HCkUnixCompress handle, const char *inFilename, HCkByteData db);

Unix compresses a file to an in-memory image of a .Z file. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

BOOL CkUnixCompress_CompressMemToFile(HCkUnixCompress handle, HCkByteData db, const char *outFilename);

Unix compresses and creates a .Z file from in-memory data. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

Returns TRUE for success, FALSE for failure.

BOOL CkUnixCompress_CompressMemory(HCkUnixCompress handle, HCkByteData dbIn, HCkByteData dbOut);

Compresses in-memory data to an in-memory image of a .Z file. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

BOOL CkUnixCompress_CompressString(HCkUnixCompress handle, const char *inStr, const char *outCharset, HCkByteData outBytes);

To be documented soon...

BOOL CkUnixCompress_CompressStringToFile(HCkUnixCompress handle, const char *inStr, const char *outCharset, const char *outFilename);

To be documented soon...

BOOL CkUnixCompress_IsUnlocked(HCkUnixCompress handle);

Returns true if the component has been unlocked. (For ActiveX, returns 1 if unlocked.)

BOOL CkUnixCompress_SaveLastError(HCkUnixCompress handle, const char *filename);

Saves the last error information to an XML formatted file.

BOOL CkUnixCompress_UnTarZ(HCkUnixCompress handle, const char *zFilename, const char *destDir, BOOL bNoAbsolute);

Unpacks a .tar.Z file. The decompress and untar occur in streaming mode. There are no temporary files and the memory footprint is constant (and small) while untarring.

Returns TRUE for success, FALSE for failure.

BOOL CkUnixCompress_UncompressFile(HCkUnixCompress handle, const char *inFilename, const char *outFilename);

Uncompresses a .Z file. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

Returns TRUE for success, FALSE for failure.

BOOL CkUnixCompress_UncompressFileToMem(HCkUnixCompress handle, const char *inFilename, HCkByteData db);

Uncompresses a .Z file directly to memory. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

BOOL CkUnixCompress_UncompressFileToString(HCkUnixCompress handle, const char *inFilename, const char *inCharset, HCkString outStr);

Uncompresses a .Z file that contains a text file. The contents of the text file are returned as a string. The character encoding of the text file is specified by charset. Typical charsets are "iso-8859-1", "utf-8", "windows-1252", "shift_JIS", "big5", etc.

List of Valid Charsets

BOOL CkUnixCompress_UncompressMemToFile(HCkUnixCompress handle, HCkByteData db, const char *outFilename);

Uncompresses from an in-memory image of a .Z file to a file. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

Returns TRUE for success, FALSE for failure.

BOOL CkUnixCompress_UncompressMemory(HCkUnixCompress handle, HCkByteData dbIn, HCkByteData dbOut);

Uncompresses from an in-memory image of a .Z file directly into memory. (This compression uses the LZW (Lempel-Ziv-Welch) compression algorithm.)

BOOL CkUnixCompress_UncompressString(HCkUnixCompress handle, HCkByteData inData, const char *inCharset, HCkString outStr);

To be documented soon...

BOOL CkUnixCompress_UnlockComponent(HCkUnixCompress handle, const char *unlockCode);

Unlocks the component allowing for the full functionality to be used.

Returns TRUE for success, FALSE for failure.

const char *CkUnixCompress_lastErrorHtml(HCkUnixCompress handle);

Error information in HTML format for the last method called.

const char *CkUnixCompress_lastErrorText(HCkUnixCompress handle);

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

const char *CkUnixCompress_lastErrorXml(HCkUnixCompress handle);

Error information in XML format for the last method called.

const char *CkUnixCompress_uncompressFileToString(HCkUnixCompress handle, const char *inFilename, const char *inCharset);

Uncompresses a .Z file that contains a text file. The contents of the text file are returned as a string. The character encoding of the text file is specified by charset. Typical charsets are "iso-8859-1", "utf-8", "windows-1252", "shift_JIS", "big5", etc.

List of Valid Charsets

const char *CkUnixCompress_uncompressString(HCkUnixCompress handle, HCkByteData inData, const char *inCharset);

To be documented soon...