ZlibArchive

public class ZlibArchive: Archive

Provides unarchive and archive functions for Zlib archives.

  • Unarchives Zlib archive.

    If data passed is not actually a Zlib archive, ZlibError will be thrown.

    If data in archive is not actually compressed with Deflate algorithm, DeflateError will be thrown.

    Note

    This function is specification compliant.

    Throws

    DeflateError or ZlibError depending on the type of the problem. It may indicate that either archive is damaged or it might not be archived with Zlib or compressed with Deflate at all.

    Declaration

    Swift

    public static func unarchive(archive data: Data) throws -> Data

    Parameters

    archive

    Data archived with Zlib.

    Return Value

    Unarchived data.

  • Archives data into Zlib archive. Data will be also compressed with Deflate algorithm. It will also be specified in archive’s header that the compressor used the slowest Deflate algorithm.

    If during compression something goes wrong DeflateError will be thrown.

    Note

    This function is specification compliant.

    Throws

    DeflateError if an error was encountered during compression.

    Declaration

    Swift

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

    Parameters

    data

    Data to compress and archive.

    Return Value

    Resulting archive’s data.