class Poco::InflatingStreamBuf

Overview

This is the streambuf class used by InflatingInputStream and InflatingOutputStream. Moreā€¦

#include <InflatingStream.h>

class InflatingStreamBuf: public Poco::BasicBufferedStreamBuf
{
public:
    // enums

    enum StreamType;

    // construction

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

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

    InflatingStreamBuf(
        std::ostream& ostr,
        StreamType type
        );

    InflatingStreamBuf(
        std::ostream& ostr,
        int windowBits
        );

    // methods

    int
    close();

    void
    reset();

protected:
    // methods

    int
    readFromDevice(
        char* buffer,
        std::streamsize length
        );

    int
    writeToDevice(
        const char* buffer,
        std::streamsize length
        );

    virtual
    int
    sync();
};

Inherited Members

public:
    // methods

    virtual
    int_type
    overflow(int_type c);

    virtual
    int_type
    underflow();

    virtual
    int
    sync();

protected:
    // typedefs

    typedef std::basic_streambuf<ch, tr> Base;
    typedef std::basic_ios<ch, tr> IOS;
    typedef ch char_type;
    typedef tr char_traits;
    typedef ba Allocator;
    typedef Base::int_type int_type;
    typedef Base::pos_type pos_type;
    typedef Base::off_type off_type;
    typedef IOS::openmode openmode;

    // methods

    void
    setMode(openmode mode);

    openmode
    getMode() const;

Detailed Documentation

This is the streambuf class used by InflatingInputStream and InflatingOutputStream.

The actual work is delegated to zlib (see http://zlib.net). Both zlib (deflate) streams and gzip streams are supported. Output streams should always call close() to ensure proper completion of decompression.

Construction

InflatingStreamBuf(
    std::istream& istr,
    StreamType type
    )

Creates an InflatingStreamBuf for expanding the compressed data read from the give input stream.

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

Creates an InflatingStreamBuf 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.

InflatingStreamBuf(
    std::ostream& ostr,
    StreamType type
    )

Creates an InflatingStreamBuf for expanding the compressed data passed through and forwarding it to the given output stream.

InflatingStreamBuf(
    std::ostream& ostr,
    int windowBits
    )

Creates an InflatingStreamBuf for expanding the compressed data passed through and forwarding it to the given output stream.

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

Methods

int
close()

Finishes up the stream.

Must be called when inflating to an output stream.

void
reset()

Resets the stream buffer.