BZip2

public class BZip2 : DecompressionAlgorithm
extension BZip2: CompressionAlgorithm

Provides functions for compression and decompression for BZip2 algorithm.

  • Decompresses data using BZip2 algortihm.

    Throws

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

    Declaration

    Swift

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

    Parameters

    data

    Data compressed with BZip2.

    Return Value

    Decompressed data.

  • Represents the size of the blocks in which data is split during BZip2 compression.

    See more

    Declaration

    Swift

    public enum BlockSize : Int
  • Compresses data with BZip2 algortihm.

    Note

    Input data will be split into blocks of size 100 KB. Use BZip2.compress(data:blockSize:) function to specify the size of a block.

    Declaration

    Swift

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

    Parameters

    data

    Data to compress.

  • Compresses data with BZip2 algortihm, splitting data into blocks of specified blockSize.

    Declaration

    Swift

    public static func compress(data: Data, blockSize: BlockSize) -> Data

    Parameters

    data

    Data to compress.

    blockSize

    Size of blocks in which data will be split.