BZip2
public class BZip2 : DecompressionAlgorithm
extension BZip2: CompressionAlgorithm
Provides functions for compression and decompression for BZip2 algorithm.
-
Decompresses
datausing BZip2 algortihm.Throws
BZip2Errorif unexpected byte (bit) sequence was encountered indata. 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 -> DataParameters
dataData compressed with BZip2.
Return Value
Decompressed data.
-
Decompresses one or more concatenated BZip2 archives found in
data.Throws
BZip2Errorif an unexpected byte (bit) sequence was encountered or a checksum mismatch is detected for any archive. It may indicate that the input is damaged or it might not be compressed with BZip2 at all. IfBZip2Error.wrongCRCis thrown, its associated value contains only the bytes decompressed for the archive that failed the checksum.Declaration
Swift
public static func multiDecompress(data: Data) throws -> [Data]Parameters
dataData that may contain one or more concatenated BZip2 archives.
Return Value
An array of decompressed data, one element per archive, in the same order as they appear in the input.
-
Represents the size of the blocks in which data is split during BZip2 compression.
See moreDeclaration
Swift
public enum BlockSize : Int -
Compresses
datawith 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) -> DataParameters
dataData to compress.
-
Compresses
datawith BZip2 algortihm, splitting data into blocks of specifiedblockSize.Declaration
Swift
public static func compress(data: Data, blockSize: BlockSize) -> DataParameters
dataData to compress.
blockSizeSize of blocks in which
datawill be split.
View on GitHub