@@ -35,7 +35,7 @@ public extension Data
35
35
/// Compresses the data.
36
36
/// - parameter withAlgorithm: Compression algorithm to use. See the `CompressionAlgorithm` type
37
37
/// - returns: compressed data
38
- public func compress( withAlgorithm algo: CompressionAlgorithm ) -> Data ?
38
+ func compress( withAlgorithm algo: CompressionAlgorithm ) -> Data ?
39
39
{
40
40
return self . withUnsafeBytes { ( sourcePtr: UnsafePointer < UInt8 > ) -> Data ? in
41
41
let config = ( operation: COMPRESSION_STREAM_ENCODE, algorithm: algo. lowLevelType)
@@ -46,7 +46,7 @@ public extension Data
46
46
/// Decompresses the data.
47
47
/// - parameter withAlgorithm: Compression algorithm to use. See the `CompressionAlgorithm` type
48
48
/// - returns: decompressed data
49
- public func decompress( withAlgorithm algo: CompressionAlgorithm ) -> Data ?
49
+ func decompress( withAlgorithm algo: CompressionAlgorithm ) -> Data ?
50
50
{
51
51
return self . withUnsafeBytes { ( sourcePtr: UnsafePointer < UInt8 > ) -> Data ? in
52
52
let config = ( operation: COMPRESSION_STREAM_DECODE, algorithm: algo. lowLevelType)
@@ -60,7 +60,7 @@ public extension Data
60
60
/// lzfse : Apples custom Lempel-Ziv style compression algorithm. Claims to compress as good as zlib but 2 to 3 times faster.
61
61
/// lzma : Horribly slow. Compression as well as decompression. Compresses better than zlib though.
62
62
/// lz4 : Fast, but compression rate is very bad. Apples lz4 implementation often to not compress at all.
63
- public enum CompressionAlgorithm
63
+ enum CompressionAlgorithm
64
64
{
65
65
case zlib
66
66
case lzfse
@@ -71,7 +71,7 @@ public extension Data
71
71
/// Compresses the data using the zlib deflate algorithm.
72
72
/// - returns: raw deflated data according to [RFC-1951](https://tools.ietf.org/html/rfc1951).
73
73
/// - note: Fixed at compression level 5 (best trade off between speed and time)
74
- public func deflate( ) -> Data ?
74
+ func deflate( ) -> Data ?
75
75
{
76
76
return self . withUnsafeBytes { ( sourcePtr: UnsafePointer < UInt8 > ) -> Data ? in
77
77
let config = ( operation: COMPRESSION_STREAM_ENCODE, algorithm: COMPRESSION_ZLIB)
@@ -82,7 +82,7 @@ public extension Data
82
82
/// Decompresses the data using the zlib deflate algorithm. Self is expected to be a raw deflate
83
83
/// stream according to [RFC-1951](https://tools.ietf.org/html/rfc1951).
84
84
/// - returns: uncompressed data
85
- public func inflate( ) -> Data ?
85
+ func inflate( ) -> Data ?
86
86
{
87
87
return self . withUnsafeBytes { ( sourcePtr: UnsafePointer < UInt8 > ) -> Data ? in
88
88
let config = ( operation: COMPRESSION_STREAM_DECODE, algorithm: COMPRESSION_ZLIB)
@@ -93,7 +93,7 @@ public extension Data
93
93
/// Compresses the data using the deflate algorithm and makes it comply to the zlib format.
94
94
/// - returns: deflated data in zlib format [RFC-1950](https://tools.ietf.org/html/rfc1950)
95
95
/// - note: Fixed at compression level 5 (best trade off between speed and time)
96
- public func zip( ) -> Data ?
96
+ func zip( ) -> Data ?
97
97
{
98
98
let header = Data ( bytes: [ 0x78 , 0x5e ] )
99
99
@@ -113,7 +113,7 @@ public extension Data
113
113
/// Decompresses the data using the zlib deflate algorithm. Self is expected to be a zlib deflate
114
114
/// stream according to [RFC-1950](https://tools.ietf.org/html/rfc1950).
115
115
/// - returns: uncompressed data
116
- public func unzip( skipCheckSumValidation: Bool = true ) -> Data ?
116
+ func unzip( skipCheckSumValidation: Bool = true ) -> Data ?
117
117
{
118
118
// 2 byte header + 4 byte adler32 checksum
119
119
let overhead = 6
@@ -151,7 +151,7 @@ public extension Data
151
151
/// Compresses the data using the deflate algorithm and makes it comply to the gzip stream format.
152
152
/// - returns: deflated data in gzip format [RFC-1952](https://tools.ietf.org/html/rfc1952)
153
153
/// - note: Fixed at compression level 5 (best trade off between speed and time)
154
- public func gzip( ) -> Data ?
154
+ func gzip( ) -> Data ?
155
155
{
156
156
var header = Data ( bytes: [ 0x1f , 0x8b , 0x08 , 0x00 ] ) // magic, magic, deflate, noflags
157
157
@@ -181,7 +181,7 @@ public extension Data
181
181
/// Decompresses the data using the gzip deflate algorithm. Self is expected to be a gzip deflate
182
182
/// stream according to [RFC-1952](https://tools.ietf.org/html/rfc1952).
183
183
/// - returns: uncompressed data
184
- public func gunzip( ) -> Data ?
184
+ func gunzip( ) -> Data ?
185
185
{
186
186
// 10 byte header + data + 8 byte footer. See https://tools.ietf.org/html/rfc1952#section-2
187
187
let overhead = 10 + 8
@@ -247,7 +247,7 @@ public extension Data
247
247
248
248
/// Calculate the Adler32 checksum of the data.
249
249
/// - returns: Adler32 checksum type. Can still be further advanced.
250
- public func adler32( ) -> Adler32
250
+ func adler32( ) -> Adler32
251
251
{
252
252
var res = Adler32 ( )
253
253
res. advance ( withChunk: self )
@@ -256,7 +256,7 @@ public extension Data
256
256
257
257
/// Calculate the Crc32 checksum of the data.
258
258
/// - returns: Crc32 checksum type. Can still be further advanced.
259
- public func crc32( ) -> Crc32
259
+ func crc32( ) -> Crc32
260
260
{
261
261
var res = Crc32 ( )
262
262
res. advance ( withChunk: self )
0 commit comments