template class Poco::BasicBufferedStreamBuf

Overview

This is an implementation of a buffered streambuf that greatly simplifies the implementation of custom streambufs of various kinds. Moreā€¦

#include <BufferedStreamBuf.h>

template <
    typename ch,
    typename tr,
    typename ba = BufferAllocator<ch>
    >
class BasicBufferedStreamBuf: public std::basic_streambuf< ch, tr >
{
public:
    // construction

    BasicBufferedStreamBuf(
        std::streamsize bufferSize,
        openmode mode
        );

    // 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;
};

// direct descendants

class DeflatingStreamBuf;
class DigestBuf;
class InflatingStreamBuf;
class HTTPChunkedStreamBuf;
class HTTPFixedLengthStreamBuf;
class HTTPHeaderStreamBuf;
class HTTPStreamBuf;
class MultipartStreamBuf;
class PipeStreamBuf;
class RandomBuf;

Detailed Documentation

This is an implementation of a buffered streambuf that greatly simplifies the implementation of custom streambufs of various kinds.

Derived classes only have to override the methods readFromDevice() or writeToDevice().

This streambuf only supports unidirectional streams. In other words, the BasicBufferedStreamBuf can be used for the implementation of an istream or an ostream, but not for an iostream.