Contents Up Previous Next

wxZlibInputStream

This filter stream decompresses a stream that is in zlib or gzip format. Note that reading the gzip format requires zlib version 1.2.1 or greater, (the builtin version does support gzips).

The stream is not seekable, SeekI() returns wxInvalidOffset. Also GetSize() is not supported, it always returns 0.

Derived from

wxFilterInputStream

Include files

<wx/zstream.h>

See also

wxInputStream, wxZlibOutputStream.

Members

wxZlibInputStream::wxZlibInputStream
wxZlibInputStream::CanHandleGZip


wxZlibInputStream::wxZlibInputStream

wxZlibInputStream(wxInputStream& stream, int flags = wxZLIB_AUTO)

The flags wxZLIB_ZLIB and wxZLIB_GZIP specify whether the input data is in zlib or gzip format. If wxZLIB_AUTO is used, then zlib will autodetect the stream type, this is the default.

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

This version is not by default compatible with the output produced by the version of wxZlibOutputStream in wxWidgets 2.4.x. However, there is a compatibilty mode, which is switched on by passing wxZLIB_24COMPATIBLE for flags. Note that in when operating in compatibilty mode error checking is very much reduced. The following symbols can be use for the flags:

// Flags
enum {
#if WXWIN_COMPATIBILITY_2_4
    wxZLIB_24COMPATIBLE = 4, // read v2.4.x data without error
#endif
    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+
    wxZLIB_AUTO = 3          // autodetect header zlib or gzip
};

wxZlibInputStream::CanHandleGZip

static bool CanHandleGZip()

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