Proyectos de Subversion Iphone Microlearning

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
// Copyright 2018 Google
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
 
15
#import <Foundation/Foundation.h>
16
 
17
/// This is a copy of Google Toolbox for Mac library to avoid creating an extra framework.
18
 
19
// NOTE: For 64bit, none of these apis handle input sizes >32bits, they will return nil when given
20
// such data. To handle data of that size you really should be streaming it rather then doing it all
21
// in memory.
22
 
23
@interface NSData (GULGzip)
24
 
25
/// Returns an data as the result of decompressing the payload of |data|.The data to decompress must
26
/// be a gzipped payloads.
27
+ (NSData *)gul_dataByInflatingGzippedData:(NSData *)data error:(NSError **)error;
28
 
29
/// Returns an compressed data with the result of gzipping the payload of |data|. Uses the default
30
/// compression level.
31
+ (NSData *)gul_dataByGzippingData:(NSData *)data error:(NSError **)error;
32
 
33
FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorDomain;
34
FOUNDATION_EXPORT NSString *const GULNSDataZlibErrorKey;           // NSNumber
35
FOUNDATION_EXPORT NSString *const GULNSDataZlibRemainingBytesKey;  // NSNumber
36
 
37
typedef NS_ENUM(NSInteger, GULNSDataZlibError) {
38
  GULNSDataZlibErrorGreaterThan32BitsToCompress = 1024,
39
  // An internal zlib error.
40
  // GULNSDataZlibErrorKey will contain the error value.
41
  // NSLocalizedDescriptionKey may contain an error string from zlib.
42
  // Look in zlib.h for list of errors.
43
  GULNSDataZlibErrorInternal,
44
  // There was left over data in the buffer that was not used.
45
  // GULNSDataZlibRemainingBytesKey will contain number of remaining bytes.
46
  GULNSDataZlibErrorDataRemaining
47
};
48
 
49
@end