aboutsummaryrefslogtreecommitdiff
path: root/Foundation/GTMNSData+zlib.h
diff options
context:
space:
mode:
authorGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-27 22:30:11 +0000
committerGravatar gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3>2012-02-27 22:30:11 +0000
commitba4b222bea6694d654ab6b89bcd452dd5a67e42f (patch)
treefb18483777e0b68a17a979f8c20e0dd17726c983 /Foundation/GTMNSData+zlib.h
parented21e9bab5c58a051274f957f1de79bb87a21a7e (diff)
[Author: thomasvl]
Add support for raw inflate/deflate without a header. R=dmaclach DELTA=416 (327 added, 69 deleted, 20 changed)
Diffstat (limited to 'Foundation/GTMNSData+zlib.h')
-rw-r--r--Foundation/GTMNSData+zlib.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/Foundation/GTMNSData+zlib.h b/Foundation/GTMNSData+zlib.h
index 3ea7db8..08fbb9a 100644
--- a/Foundation/GTMNSData+zlib.h
+++ b/Foundation/GTMNSData+zlib.h
@@ -26,6 +26,8 @@
// return nil when given such data. To handle data of that size you really
// should be streaming it rather then doing it all in memory.
+#pragma mark Gzip Compression
+
/// Return an autoreleased NSData w/ the result of gzipping the bytes.
//
// Uses the default compression level.
@@ -48,6 +50,8 @@
+ (NSData *)gtm_dataByGzippingData:(NSData *)data
compressionLevel:(int)level;
+#pragma mark Zlib "Stream" Compression
+
// NOTE: deflate is *NOT* gzip. deflate is a "zlib" stream. pick which one
// you really want to create. (the inflate api will handle either)
@@ -73,6 +77,7 @@
+ (NSData *)gtm_dataByDeflatingData:(NSData *)data
compressionLevel:(int)level;
+#pragma mark Uncompress of Gzip or Zlib
/// Return an autoreleased NSData w/ the result of decompressing the bytes.
//
@@ -85,4 +90,49 @@
// The data to decompress can be zlib or gzip payloads.
+ (NSData *)gtm_dataByInflatingData:(NSData *)data;
+
+#pragma mark "Raw" Compression Support
+
+// NOTE: raw deflate is *NOT* gzip or deflate. it does not include a header
+// of any form and should only be used within streams here an external crc/etc.
+// is done to validate the data. The RawInflate apis can be used on data
+// processed like this.
+
+/// Return an autoreleased NSData w/ the result of *raw* deflating the bytes.
+//
+// Uses the default compression level.
+// *No* header is added to the resulting data.
++ (NSData *)gtm_dataByRawDeflatingBytes:(const void *)bytes
+ length:(NSUInteger)length;
+
+/// Return an autoreleased NSData w/ the result of *raw* deflating the payload of |data|.
+//
+// Uses the default compression level.
+// *No* header is added to the resulting data.
++ (NSData *)gtm_dataByRawDeflatingData:(NSData *)data;
+
+/// Return an autoreleased NSData w/ the result of *raw* deflating the bytes using |level| compression level.
+//
+// |level| can be 1-9, any other values will be clipped to that range.
+// *No* header is added to the resulting data.
++ (NSData *)gtm_dataByRawDeflatingBytes:(const void *)bytes
+ length:(NSUInteger)length
+ compressionLevel:(int)level;
+
+/// Return an autoreleased NSData w/ the result of *raw* deflating the payload of |data| using |level| compression level.
+// *No* header is added to the resulting data.
++ (NSData *)gtm_dataByRawDeflatingData:(NSData *)data
+ compressionLevel:(int)level;
+
+/// Return an autoreleased NSData w/ the result of *raw* decompressing the bytes.
+//
+// The data to decompress, it should *not* have any header (zlib nor gzip).
++ (NSData *)gtm_dataByRawInflatingBytes:(const void *)bytes
+ length:(NSUInteger)length;
+
+/// Return an autoreleased NSData w/ the result of *raw* decompressing the payload of |data|.
+//
+// The data to decompress, it should *not* have any header (zlib nor gzip).
++ (NSData *)gtm_dataByRawInflatingData:(NSData *)data;
+
@end