LZMA

public class LZMA : DecompressionAlgorithm

Provides decompression function for LZMA.

  • Decompresses data using LZMA.

    Note

    It is assumed that the first nine bytes of data represent standard LZMA properties (so called “lc”, “lp” and “pb”), dictionary size, and uncompressed size all encoded with standard encoding scheme of LZMA format.

    Throws

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

    Declaration

    Swift

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

    Parameters

    data

    Data compressed with LZMA.

    Return Value

    Decompressed data.

  • Decompresses data using LZMA with specified algorithm’s properties, and, optionally, output’s uncompressedSize. If uncompressedSize is nil, then data must contain finish marker.

    Note

    It is assumed that data begins immediately with LZMA compressed bytes with no LZMA properties at the beginning.

    Warning

    There is no validation performed for properties of properties argument. This API is intended to be used by advanced users.

    Throws

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

    Declaration

    Swift

    public static func decompress(data: Data,
                                  properties: LZMAProperties,
                                  uncompressedSize: Int? = nil) throws -> Data

    Parameters

    data

    Data compressed with LZMA.

    properties

    Properties of LZMA (such as lc, lp, etc.)

    uncompressedSize

    Size of uncompressed data; nil if it is unknown. In case of nil, finish marker must be present in data.

    Return Value

    Decompressed data.