(Lianja) Compress Bytes
Demonstrates how to compress binary data.
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loFac = createobject("CkFileAccess")
loFileBytes = loFac.ReadEntireFile("qa_data/bmp/big.bmp")
if (loFac.LastMethodSuccess <> .T.) then
? loFac.LastErrorText
release loFac
return
endif
loCompress = createobject("CkCompression")
loCompress.Algorithm = "deflate"
loCompressedBytes = loCompress.CompressBytes(loFileBytes)
if (loCompress.LastMethodSuccess <> .T.) then
? loCompress.LastErrorText
release loFac
release loCompress
return
endif
llSuccess = loFac.WriteEntireFile("qa_output/compressedBmp.dat",loCompressedBytes)
if (loFac.LastMethodSuccess <> .T.) then
? loFac.LastErrorText
release loFac
release loCompress
return
endif
release loFac
release loCompress
|