template class Poco::BasicMemoryBinaryWriter

A convenient wrapper for using Buffer and MemoryStream with BinarWriter.

#include <BinaryWriter.h>

template <typename T>
class BasicMemoryBinaryWriter: public Poco::BinaryWriter
{
public:
    // construction

    BasicMemoryBinaryWriter(
        Buffer<T>& data,
        StreamByteOrder byteOrder = NATIVE_BYTE_ORDER
        );

    BasicMemoryBinaryWriter(
        Buffer<T>& data,
        TextEncoding& encoding,
        StreamByteOrder byteOrder = NATIVE_BYTE_ORDER
        );

    // methods

    Buffer<T>&
    data();

    const Buffer<T>&
    data() const;

    const MemoryOutputStream&
    stream() const;

    MemoryOutputStream&
    stream();
};

Inherited Members

public:
    // enums

    enum StreamByteOrder;

    // methods

    BinaryWriter&
    operator<<(bool value);

    BinaryWriter&
    operator<<(char value);

    BinaryWriter&
    operator<<(unsigned char value);

    BinaryWriter&
    operator<<(signed char value);

    BinaryWriter&
    operator<<(short value);

    BinaryWriter&
    operator<<(unsigned short value);

    BinaryWriter&
    operator<<(int value);

    BinaryWriter&
    operator<<(unsigned int value);

    BinaryWriter&
    operator<<(long value);

    BinaryWriter&
    operator<<(unsigned long value);

    BinaryWriter&
    operator<<(float value);

    BinaryWriter&
    operator<<(double value);

    BinaryWriter&
    operator<<(const std::string& value);

    BinaryWriter&
    operator<<(const char* value);

    template <typename T>
    BinaryWriter&
    operator<<(const std::vector<T>& value);

    void
    write7BitEncoded(UInt32 value);

    void
    writeRaw(const std::string& rawData);

    void
    writeRaw(
        const char* buffer,
        std::streamsize length
        );

    void
    writeBOM();

    void
    flush();

    bool
    good();

    bool
    fail();

    bool
    bad();

    std::ostream&
    stream() const;

    StreamByteOrder
    byteOrder() const;