template class Poco::BasicMemoryStreamBuf

Overview

BasicMemoryStreamBuf is a simple implementation of a stream buffer for reading and writing from a memory area. Moreā€¦

#include <MemoryStream.h>

template <
    typename ch,
    typename tr
    >
class BasicMemoryStreamBuf: public std::basic_streambuf< ch, tr >
{
public:
    // construction

    BasicMemoryStreamBuf(
        char_type* pBuffer,
        std::streamsize bufferSize
        );

    // methods

    virtual
    int_type
    overflow(int_type);

    virtual
    int_type
    underflow();

    virtual
    pos_type
    seekoff(
        off_type off,
        std::ios_base::seekdir way,
        std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
        );

    virtual
    int
    sync();

    std::streamsize
    charsWritten() const;

    void
    reset();

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 Base::int_type int_type;
    typedef Base::pos_type pos_type;
    typedef Base::off_type off_type;
};

Detailed Documentation

BasicMemoryStreamBuf is a simple implementation of a stream buffer for reading and writing from a memory area.

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

Methods

void
reset()

Resets the buffer so that current read and write positions will be set to the beginning of the buffer.