(Perl) Decompress Bytes
Demonstrates how to decompress binary data.
use 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->new();
$compressedBytes = chilkat::CkByteData->new();
$success = $fac->ReadEntireFile("qa_data/compressed/compressedBmp.dat",$compressedBytes);
if ($fac->get_LastMethodSuccess() != 1) {
print $fac->lastErrorText() . "\r\n";
exit;
}
$compress = chilkat::CkCompression->new();
$compress->put_Algorithm("deflate");
$decompressedBytes = chilkat::CkByteData->new();
$success = $compress->DecompressBytes($compressedBytes,$decompressedBytes);
if ($compress->get_LastMethodSuccess() != 1) {
print $compress->lastErrorText() . "\r\n";
exit;
}
$success = $fac->WriteEntireFile("qa_output/decompressed.bmp",$decompressedBytes);
if ($fac->get_LastMethodSuccess() != 1) {
print $fac->lastErrorText() . "\r\n";
exit;
}
|