(Objective-C) Decompress Bytes
Demonstrates how to decompress binary data.
#import <CkoFileAccess.h>
#import <CkoCompression.h>
// 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
CkoFileAccess *fac = [[CkoFileAccess alloc] init];
NSData compressedBytes;
compressedBytes = [fac ReadEntireFile: @"qa_data/compressed/compressedBmp.dat"];
if (fac.LastMethodSuccess != YES) {
NSLog(@"%@",fac.LastErrorText);
return;
}
CkoCompression *compress = [[CkoCompression alloc] init];
compress.Algorithm = @"deflate";
NSData decompressedBytes;
decompressedBytes = [compress DecompressBytes: compressedBytes];
if (compress.LastMethodSuccess != YES) {
NSLog(@"%@",compress.LastErrorText);
return;
}
BOOL success = [fac WriteEntireFile: @"qa_output/decompressed.bmp" fileData: decompressedBytes];
if (fac.LastMethodSuccess != YES) {
NSLog(@"%@",fac.LastErrorText);
return;
}
|