class Poco::HexBinaryEncoderBuf

Overview

This streambuf encodes all data written to it in hexBinary encoding and forwards it to a connected ostream. More…

#include <HexBinaryEncoder.h>

class HexBinaryEncoderBuf: public Poco::BasicUnbufferedStreamBuf
{
public:
    // construction

    HexBinaryEncoderBuf(std::ostream& ostr);

    // methods

    int
    close();

    void
    setLineLength(int lineLength);

    int
    getLineLength() const;

    void
    setUppercase(bool flag = true);
};

Inherited Members

public:
    // methods

    virtual
    int_type
    overflow(int_type c);

    virtual
    int_type
    underflow();

    virtual
    int_type
    uflow();

    virtual
    int_type
    pbackfail(int_type c);

    virtual
    std::streamsize
    xsgetn(
        char_type* p,
        std::streamsize count
        );

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;
    typedef IOS::openmode openmode;

    // methods

    static
    int_type
    charToInt(char_type c);

Detailed Documentation

This streambuf encodes all data written to it in hexBinary encoding and forwards it to a connected ostream.

In hexBinary encoding, each binary octet is encoded as a character tuple, consisting of two hexadecimal digits ([0-9a-fA-F]) representing the octet code. See also: XML Schema Part 2: Datatypes (http://www.w3.org/TR/xmlschema-2/), section 3.2.15.

Note: The characters are directly written to the ostream’s streambuf, thus bypassing the ostream. The ostream’s state is therefore not updated to match the buffer’s state.

Methods

int
close()

Closes the stream buffer.

void
setLineLength(int lineLength)

Specify the line length.

After the given number of characters have been written, a newline character will be written.

Specify 0 for an unlimited line length.

int
getLineLength() const

Returns the currently set line length.

void
setUppercase(bool flag = true)

Specify whether hex digits a-f are written in upper or lower case.