Contents

withCompressionStream(appendingTo:flags:threadCount:_:)

Reopens a compression sequential output stream and calls the given closure.

Declaration

static func withCompressionStream<E>(appendingTo compressedStream: ArchiveByteStream, flags: ArchiveFlags = [], threadCount: Int = 0, _ body: (ArchiveByteStream) throws -> E) throws -> E

Parameters

  • compressedStream:

    The output stream that the function reopens and receives the compressed data.

  • flags:

    Flags that control the behavior of the operation.

  • threadCount:

    The number of worker threads that the operation uses, set to 0 for default.

  • body:

    A closure with the archive byte stream passed as a parameter.

Return Value

The result of the closure.

Discussion

This function opens a stream created by compressionStream(appendingTo:flags:threadCount:), calls the specified closure, and closes the stream.

See Also

Compressing Data