Poco::FastInfoset

class BitStreamWriter

File Information

Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/BitStreamWriter.h

Description

A BitStreamWriter writes single bits to the encapsulated output stream. Single bits are written in highest bits first order, i.e. if 8 bits are written, the first bit is written to bit position 7 and the last one to bit position 0. If data types larger than a byte are written, they are serialized as big endian numbers, i.e. byte n-1, then n-2,... 1, 0. String types are written starting with the first character.

Member Summary

Member Functions: bitPos, complete, flush, write, writeBits

Constructors

BitStreamWriter

BitStreamWriter(
    std::ostream & outStream,
    bool paddingBit
);

Creates the BitStreamWriter. Writes bits to the given outStream, serializes data always in Big endian byte order, and, when closing the stream, fills up incomplete bytes with the defined padding bit value.

Destructor

~BitStreamWriter virtual

virtual ~BitStreamWriter();

Destroys the BitStreamWriter.

Member Functions

bitPos inline

int bitPos() const;

Returns the bit position in relation to the current byte. I.e., numBitsWritten % 8

complete inline

void complete();

Fills up any incomplete byte with the default padding bits.

complete

void complete(
    bool padBit
);

Fills up any incomplete byte with the specified padBit.

flush inline

void flush();

Writes all full bytes to the underlying output stream which is then flushed.

write inline

void write(
    bool value
);

Writes a single bit to the outputstream (1 if value is true, false otherwise).

write

void write(
    const std::string & str
);

Writes the full string without '\0'.

write

void write(
    const char * pStr
);

Writes the full string without '\0'.

write

void write(
    const char * pStr,
    std::size_t numBytes
);

Writes numBytes from pStr.

write

void write(
    char value,
    int numOfBits = Utility::SIZEOFCHARINBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::Int8 value,
    int numOfBits = Utility::SIZEOFCHARINBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::Int16 value,
    int numOfBits = Utility::SIZEOFINT16INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::Int32 value,
    int numOfBits = Utility::SIZEOFINT32INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::Int64 value,
    int numOfBits = Utility::SIZEOFINT64INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::UInt8 value,
    int numOfBits = Utility::SIZEOFCHARINBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::UInt16 value,
    int numOfBits = Utility::SIZEOFINT16INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::UInt32 value,
    int numOfBits = Utility::SIZEOFINT32INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

write

void write(
    Poco::UInt64 value,
    int numOfBits = Utility::SIZEOFINT64INBIT
);

Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.

writeBits

void writeBits(
    int cnt,
    bool value = false
);

Write cnt padding bits (value false corresponds to 0, true to 1).

Securely control IoT edge devices from anywhere   Connect a Device