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
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 ~BitStreamWriter();
Destroys the BitStreamWriter.
Member Functions
bitPos
int bitPos() const;
Returns the bit position in relation to the current byte. I.e., numBitsWritten % 8
complete
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
void flush();
Writes all full bytes to the underlying output stream which is then flushed.
write
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).