Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/BitStreamWriter.h
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 Functions: bitPos, complete, flush, write, writeBits
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.
virtual ~BitStreamWriter();
Destroys the BitStreamWriter.
int bitPos() const;
Returns the bit position in relation to the current byte. I.e., numBitsWritten % 8
void complete();
Fills up any incomplete byte with the default padding bits.
void complete(
bool padBit
);
Fills up any incomplete byte with the specified padBit.
void flush();
Writes all full bytes to the underlying output stream which is then flushed.
void write(
bool value
);
Writes a single bit to the outputstream (1 if value is true, false otherwise).
void write(
const std::string & str
);
Writes the full string without '\0'.
void write(
const char * pStr
);
Writes the full string without '\0'.
void write(
const char * pStr,
std::size_t numBytes
);
Writes numBytes from pStr.
void write(
char value,
int numOfBits = Utility::SIZEOFCHARINBIT
);
Writes from the value the first numOfBits. Invalid parameters for numOfBits will result in an exception.
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.
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.
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.
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.
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.
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.
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.
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.
void writeBits(
int cnt,
bool value = false
);
Write cnt padding bits (value false corresponds to 0, true to 1).