## wxZlibOutputStream

This stream compresses all data written to it. The compressed output can be in zlib or gzip format. Note that writing the gzip format requires zlib version 1.2.1 or greater (the builtin version does support gzip format).

The stream is not seekable, SeekO() returns wxInvalidOffset.

Derived from

wxFilterOutputStream

Include files

<wx/zstream.h>

See also

wxOutputStream, wxZlibInputStream

Members

wxZlibOutputStream::wxZlibOutputStream
wxZlibOutputStream::CanHandleGZip

### wxZlibOutputStream::wxZlibOutputStream

wxZlibOutputStream(wxOutputStream& stream, int level = -1, int flags = wxZLIB_ZLIB)

Creates a new write-only compressed stream. level means level of compression. It is number between 0 and 9 (including these values) where 0 means no compression and 9 best but slowest compression. -1 is default value (currently equivalent to 6).

The flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the output data will be in zlib or gzip format. wxZLIB_ZLIB is the default.

If flags is wxZLIB_NO_HEADER, then a raw deflate stream is output without either zlib or gzip headers. This is a lower level mode, which is not usually used directly. It can be used to embed a raw deflate stream in a higher level protocol.

The following symbols can be use for the compression level and flags:

    // Compression level
    enum {
        wxZ_DEFAULT_COMPRESSION = -1,
        wxZ_NO_COMPRESSION = 0,
        wxZ_BEST_SPEED = 1,
        wxZ_BEST_COMPRESSION = 9
    };

    // Flags
    enum {
        wxZLIB_NO_HEADER = 0,   // raw deflate stream, no header or checksum
        wxZLIB_ZLIB = 1,        // zlib header and checksum
        wxZLIB_GZIP = 2         // gzip header and checksum, requires zlib 1.2.1+
    };

### wxZlibOutputStream::CanHandleGZip

static bool CanHandleGZip()

Returns true if zlib library in use can handle gzip compressed data.