(CkPython) Decompress Bytes
Demonstrates how to decompress binary data.
import sys
import chilkat
# This example requires the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
# See this example to compress bytes: Compress Bytes
fac = chilkat.CkFileAccess()
compressedBytes = chilkat.CkByteData()
success = fac.ReadEntireFile("qa_data/compressed/compressedBmp.dat",compressedBytes)
if (fac.get_LastMethodSuccess() != True):
print(fac.lastErrorText())
sys.exit()
compress = chilkat.CkCompression()
compress.put_Algorithm("deflate")
decompressedBytes = chilkat.CkByteData()
success = compress.DecompressBytes(compressedBytes,decompressedBytes)
if (compress.get_LastMethodSuccess() != True):
print(compress.lastErrorText())
sys.exit()
success = fac.WriteEntireFile("qa_output/decompressed.bmp",decompressedBytes)
if (fac.get_LastMethodSuccess() != True):
print(fac.lastErrorText())
sys.exit()
|