Structure

compression_stream

A structure representing a compression stream.

Declaration

typedef struct {
    ...
} compression_stream;

Overview

The basic workflow for using the stream interface is as follows:

  1. Initialize the state of your compression_stream structure by calling compression_stream_init with the operation parameter set to specify whether you are encoding or decoding, and the chosen algorithm specified by the algorithm parameter. This allocates storage for the state that allows you to resume encoding or decoding across calls.

  2. Set the dst_buffer, dst_size, src_buffer, and src_size fields of the compression_stream object to point to the next blocks that your code processes.

  3. Call compression_stream_process. If no further input will be added to the stream via subsequent calls, flags should be COMPRESSION_STREAM_FINALIZE (otherwise 0). If compression_stream_process returns COMPRESSION_STATUS_END, there is no further output from the stream.

  4. Repeat steps 2 and 3 as necessary to process the entire stream.

  5. Call compression_stream_destroy to free the state object in the stream structure.

Topics

Compression Stream Properties

dst_ptr

A pointer to the first byte of the destination buffer.

dst_size

The size, in bytes, of the destination buffer.

src_ptr

A pointer to the first byte of the source buffer.

src_size

The size, in bytes, of the source buffer.

state

The stream state object of the compression stream.

See Also

Multiple-Step Compression

Compressing and Decompressing Files with Stream Compression

Perform compression or the appropriate kind of decompression to a file based on its path extension.

compression_stream_init

Initializes a compression stream for either compression or decompression.

compression_stream_process

Performs compression or decompression using an initialized compression stream structure.

compression_stream_destroy

Frees any memory allocated by stream initialization function.

compression_status

A set of values used to represent the status of stream compression.

compression_stream_flags

A set of values used to represent stream compression flags.

compression_stream_operation

A set of values used to represent a stream compression operation.