Compresses a data buffer in zLib format. The resulting zipped buffer can be unzipped with the ZipUncompressZlib2 function. The ZipCompressZlib2 function uses the deflate compression algorithm and prepends the zLib header.
Zip.bdh
ZipCompressZlib2( in sSource : string, out sDest : string, in nCompLevel : number optional ) : boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
sSource | Source buffer to be compressed in zLib format. |
sDest | Destination buffer used to store the compressed data. |
nCompLevel |
Level of compression. The compression level must be ZIP_COMPRESSION_DEFAULT, or between 0 and 9 (optional):
|
transaction TMain var sUnzipped: string; sZipped : string; i : number; begin for i := 1 to sizeof(sUnzipped) do sUnzipped[i] := chr(ord('a') + ((i-1) mod 26)); end; ZipCompressZlib2(sUnzipped, sZipped); WriteLn("Size of unzipped buffer: " + string(Binlen(sUnzipped))); WriteLn("Size of zipped buffer: " + string(Binlen(sZipped))); ZipUncompressZlib2(sZipped, sUnzipped); WriteData(sUnzipped) endTMain;
Size of unzipped buffer: 254 Size of zipped buffer: 37 abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrst