C++ String Compression: PPMD, Deflate, BZip2, LZW

This C++ example demonstrates string compression using four different compression algorithms: PPMD, Deflate, BZip2, and LZW. void TestCompression(const char *algorithm) { CkCompression comp; comp.put_Algorithm(algorithm); printf (“algorithm: %s\n”,algorithm); CkByteData compressedData; comp.CompressString(“abc abc abc abc abc abc abc abc abc abc abc 123 123 abc 123”,compressedData); // Get the compressed data: const unsigned char *pCompressedData = compressedData.getBytes(); unsigned long numBytes = compressedData.getSize(); […]

GZip Inflate/Deflate vs Compress/Uncompress clarification

In a nutshell, a GZIP file consists of a header followed by compressed data (using the “deflate” compression algorithm), followed by a trailer. The GZIP file format is specified here: GZIP file format. The Chilkat GZip component’s Compress* and Uncompress* methods read and write the GZIP file format. Data passed to an Uncompress* method should contain the header, compressed data, […]