Performs compression or decompression using an initialized compression stream structure.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
A pointer to an allocated and fully initialized
A value of type
compression, interpreted as follows:
COMPRESSIONmeans that processing was successful, but the stream may produce more output. Call the function again with updated parameters.
COMPRESSIONmeans that processing was successful, and the stream will produce no more output (this only occurs if
flagsis set to
COMPRESSIONmeans an error occurred.
compression is called successfully, the function consumes data from the source buffer and writes data into the destination buffer, until it reaches the end of one of the buffers and returns either
After a successful call, the function updates the buffer parameters in the stream object: the function increments
src (and decrements
src) by the number of input bytes consumed. Likewise, the function incremets
dst (and decrements
dst) by the number of output bytes produced. The sum (
src) remains unchanged, and so does (
dst). At this point, either
dst will be 0, indicating that the source buffer is empty or the destination buffer is full.
If the source buffer is empty, you can refill it with more data and adjust the parameters, or point to a different buffer for the next call. If you don't provide any more input data, set
COMPRESSION and call again.
If the destination buffer is full and the return value is not
COMPRESSION, there may still be input available for processing. To let this happen, you might grow the buffer, move the pointer back to reuse the buffer, or point to a new destination buffer, and then call again.