class Poco::InflatingInputStream

Overview

This stream decompresses all data passing through it using zlib’s inflate algorithm. More…

#include <InflatingStream.h>

class InflatingInputStream:
    public istream,
    public Poco::InflatingIOS
{
public:
    // construction

    InflatingInputStream(
        std::istream& istr,
        InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB
        );

    InflatingInputStream(
        std::istream& istr,
        int windowBits
        );

    // methods

    void
    reset();
};

Inherited Members

public:
    // methods

    InflatingStreamBuf*
    rdbuf();

protected:
    // fields

    InflatingStreamBuf _buf;

Detailed Documentation

This stream decompresses all data passing through it using zlib’s inflate algorithm.

Example:

std::ifstream istr("data.gz", std::ios::binary);
InflatingInputStream inflater(istr, InflatingStreamBuf::STREAM_GZIP);
std::string data;
inflater >> data;

The underlying input stream can contain more than one gzip/deflate stream. After a gzip/deflate stream has been processed, reset() can be called to inflate the next stream.

Construction

InflatingInputStream(
    std::istream& istr,
    InflatingStreamBuf::StreamType type = InflatingStreamBuf::STREAM_ZLIB
    )

Creates an InflatingInputStream for expanding the compressed data read from the given input stream.

InflatingInputStream(
    std::istream& istr,
    int windowBits
    )

Creates an InflatingInputStream for expanding the compressed data read from the given input stream.

Please refer to the zlib documentation of inflateInit2() for a description of the windowBits parameter.

Methods

void
reset()

Resets the zlib machinery so that another zlib stream can be read from the same underlying input stream.