1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/GoogleToolboxSubset/GTMNSData+zlib.h Tue May 12 14:38:30 2009 +0200
1.3 @@ -0,0 +1,84 @@
1.4 +//
1.5 +// GTMNSData+zlib.h
1.6 +//
1.7 +// Copyright 2007-2008 Google Inc.
1.8 +//
1.9 +// Licensed under the Apache License, Version 2.0 (the "License"); you may not
1.10 +// use this file except in compliance with the License. You may obtain a copy
1.11 +// of the License at
1.12 +//
1.13 +// http://www.apache.org/licenses/LICENSE-2.0
1.14 +//
1.15 +// Unless required by applicable law or agreed to in writing, software
1.16 +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
1.17 +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
1.18 +// License for the specific language governing permissions and limitations under
1.19 +// the License.
1.20 +//
1.21 +
1.22 +#import <Foundation/Foundation.h>
1.23 +#import "GTMDefines.h"
1.24 +
1.25 +/// Helpers for dealing w/ zlib inflate/deflate calls.
1.26 +@interface NSData (GTMZLibAdditions)
1.27 +
1.28 +/// Return an autoreleased NSData w/ the result of gzipping the bytes.
1.29 +//
1.30 +// Uses the default compression level.
1.31 ++ (NSData *)gtm_dataByGzippingBytes:(const void *)bytes
1.32 + length:(NSUInteger)length;
1.33 +
1.34 +/// Return an autoreleased NSData w/ the result of gzipping the payload of |data|.
1.35 +//
1.36 +// Uses the default compression level.
1.37 ++ (NSData *)gtm_dataByGzippingData:(NSData *)data;
1.38 +
1.39 +/// Return an autoreleased NSData w/ the result of gzipping the bytes using |level| compression level.
1.40 +//
1.41 +// |level| can be 1-9, any other values will be clipped to that range.
1.42 ++ (NSData *)gtm_dataByGzippingBytes:(const void *)bytes
1.43 + length:(NSUInteger)length
1.44 + compressionLevel:(int)level;
1.45 +
1.46 +/// Return an autoreleased NSData w/ the result of gzipping the payload of |data| using |level| compression level.
1.47 ++ (NSData *)gtm_dataByGzippingData:(NSData *)data
1.48 + compressionLevel:(int)level;
1.49 +
1.50 +// NOTE: deflate is *NOT* gzip. deflate is a "zlib" stream. pick which one
1.51 +// you really want to create. (the inflate api will handle either)
1.52 +
1.53 +/// Return an autoreleased NSData w/ the result of deflating the bytes.
1.54 +//
1.55 +// Uses the default compression level.
1.56 ++ (NSData *)gtm_dataByDeflatingBytes:(const void *)bytes
1.57 + length:(NSUInteger)length;
1.58 +
1.59 +/// Return an autoreleased NSData w/ the result of deflating the payload of |data|.
1.60 +//
1.61 +// Uses the default compression level.
1.62 ++ (NSData *)gtm_dataByDeflatingData:(NSData *)data;
1.63 +
1.64 +/// Return an autoreleased NSData w/ the result of deflating the bytes using |level| compression level.
1.65 +//
1.66 +// |level| can be 1-9, any other values will be clipped to that range.
1.67 ++ (NSData *)gtm_dataByDeflatingBytes:(const void *)bytes
1.68 + length:(NSUInteger)length
1.69 + compressionLevel:(int)level;
1.70 +
1.71 +/// Return an autoreleased NSData w/ the result of deflating the payload of |data| using |level| compression level.
1.72 ++ (NSData *)gtm_dataByDeflatingData:(NSData *)data
1.73 + compressionLevel:(int)level;
1.74 +
1.75 +
1.76 +/// Return an autoreleased NSData w/ the result of decompressing the bytes.
1.77 +//
1.78 +// The bytes to decompress can be zlib or gzip payloads.
1.79 ++ (NSData *)gtm_dataByInflatingBytes:(const void *)bytes
1.80 + length:(NSUInteger)length;
1.81 +
1.82 +/// Return an autoreleased NSData w/ the result of decompressing the payload of |data|.
1.83 +//
1.84 +// The data to decompress can be zlib or gzip payloads.
1.85 ++ (NSData *)gtm_dataByInflatingData:(NSData *)data;
1.86 +
1.87 +@end