Deflate

public final class Deflate: DecompressionAlgorithm

Provides function to decompress data, which were compressed with DEFLATE.

  • Decompresses compressedData with DEFLATE algortihm.

    If data passed is not actually compressed with DEFLATE, DeflateError will be thrown.

    Throws

    DeflateError if unexpected byte (bit) sequence was encountered in compressedData. It may indicate that either the data is damaged or it might not be compressed with DEFLATE at all.

    Declaration

    Swift

    public static func decompress(compressedData data: Data) throws -> Data

    Parameters

    compressedData

    Data compressed with DEFLATE.

    Return Value

    Decompressed data.

  • Compresses data with DEFLATE algortihm.

    If during compression something goes wrong DeflateError will 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. Uncompressed block is created if amount of data provided is less than 3 bytes and static Huffman is used in all other cases.

    Declaration

    Swift

    public static func compress(data: Data) throws -> Data