Ignite Tools
Shared/Airship/External/UA_asi-http-request/UA_ASIDataCompressor.h
00001 //
00002 //  UA_ASIDataCompressor.h
00003 //  Part of UA_ASIHTTPRequest -> http://allseeing-i.com/ASIHTTPRequest
00004 //
00005 //  Created by Ben Copsey on 17/08/2010.
00006 //  Copyright 2010 All-Seeing Interactive. All rights reserved.
00007 //
00008 
00009 // This is a helper class used by UA_ASIHTTPRequest to handle deflating (compressing) data in memory and on disk
00010 // You may also find it helpful if you need to deflate data and files yourself - see the class methods below
00011 // Most of the zlib stuff is based on the sample code by Mark Adler available at http://zlib.net
00012 
00013 #import <Foundation/Foundation.h>
00014 #import <zlib.h>
00015 
00016 @interface UA_ASIDataCompressor : NSObject {
00017         BOOL streamReady;
00018         z_stream zStream;
00019 }
00020 
00021 // Convenience constructor will call setupStream for you
00022 + (id)compressor;
00023 
00024 // Compress the passed chunk of data
00025 - (NSData *)compressBytes:(Bytef *)bytes length:(NSUInteger)length error:(NSError **)err;
00026 
00027 // Convenience method - pass it some data, and you'll get deflated data back
00028 + (NSData *)compressData:(NSData*)uncompressedData error:(NSError **)err;
00029 
00030 // Convenience method - pass it a file containing the data to compress in sourcePath, and it will write deflated data to destinationPath
00031 + (BOOL)compressDataFromFile:(NSString *)sourcePath toFile:(NSString *)destinationPath error:(NSError **)err;
00032 
00033 // Sets up zlib to handle the inflating. You only need to call this yourself if you aren't using the convenience constructor 'compressor'
00034 - (NSError *)setupStream;
00035 
00036 // Tells zlib to clean up. You need to call this if you need to cancel deflating part way through
00037 // If deflating finishes or fails, this method will be called automatically
00038 - (NSError *)closeStream;
00039 
00040 @property (assign, readonly) BOOL streamReady;
00041 @end
 All Classes Functions Variables Properties