XZArchive

public class XZArchive : Archive

Provides unarchive function for XZ archives.

  • Unarchives XZ archive. Archives with multiple streams are supported, but uncompressed data from each stream will be combined into single Data object.

    If an error happens during LZMA2 decompression, then LZMAError or LZMA2Error will be thrown.

    Throws

    LZMAError, LZMA2Error or XZError depending on the type of the problem. Particularly, if filters other than LZMA2 are used in archive, then XZError.wrongFilterID will be thrown, but it may also indicate that either the archive is damaged or it might not be compressed with XZ or LZMA(2) at all.

    Declaration

    Swift

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

    Parameters

    archive

    Data archived using XZ format.

    Return Value

    Unarchived data.

  • Unarchives XZ archive. Archives with multiple streams are supported, and uncompressed data from each stream will be stored in a separate element in the array

    If data passed is not actually XZ archive, XZError will be thrown. Particularly, if filters other than LZMA2 are used in archive, then XZError.wrongFilterID will be thrown.

    If an error happens during LZMA2 decompression, then LZMAError or LZMA2Error will be thrown.

    Throws

    LZMAError, LZMA2Error or XZError depending on the type of the problem. It may indicate that either the archive is damaged or it might not be compressed with XZ or LZMA(2) at all.

    Declaration

    Swift

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

    Parameters

    archive

    Data archived using XZ format.

    Return Value

    Array of unarchived data from every stream in archive.