Compressing a memory buffer
With Easy Compression Library compressing and decompressing a memory buffer is a very simple task.
Compressing a memory buffer.
To compress a memory buffer you need to call ECLCompressAndEncryptBuffer function.
As the buffer data is not encrypted the Password parameter is to be blank.
This function adds an internal header to compressed data.
Decompressing a memory buffer.
To decompress a data from memory buffer you need to call ECLDecompressAndDecryptBuffer.
Example:
var
SrcBuf, CompBuf, DecompBuf: PChar;
SrcSize, CompSize, DecompSize: integer;
s: string;
begin
s := 'test-test';
SrcBuf := PChar(s);
SrcSize := Length(s)+1;
ECLCompressAndEncryptBuffer(SrcBuf, SrcSize, CompBuf, CompSize, '', ppmFastest);
ECLDecompressAndDecryptBuffer(CompBuf, CompSize, DecompBuf, DecompSize);
ShowMessage(DecompBuf);
end;
|