Deflate
public class Deflate: DecompressionAlgorithm
Provides compression and decompression functions for Deflate algorithm.
-
Decompresses
datausing Deflate algortihm.If
datais not actually compressed with Deflate,DeflateErrorwill be thrown.Note
This function is specification compliant.
Throws
DeflateErrorif unexpected byte (bit) sequence was encountered indata. It may indicate that either data is damaged or it might not be compressed with Deflate at all.Declaration
Swift
public static func decompress(data: Data) throws -> DataParameters
dataData compressed with Deflate.
Return Value
Decompressed data.
-
Compresses
datawith Deflate algortihm.If during compression something goes wrong
DeflateErrorwill be thrown.Note
Currently, SWCompression creates only one block for all data and the block can either be uncompressed or compressed with static Huffman encoding. Choice of one block type or the other depends on bytes’ statistics of data. However, if data size is greater than 65535 (the maximum value stored in 2 bytes), then static Huffman block will be created.
Declaration
Swift
public static func compress(data: Data) throws -> DataParameters
dataData to compress.
View on GitHub
Deflate Class Reference