File Information
Library: FastInfoset
Package: FastInfoset
Header: Poco/FastInfoset/BitStreamReader.h
Description
A BitStreamReader reads single bits from the input stream. Single bits are read in highest bits first order, i.e. if 8 bits are read, the first bit is read from bit position 7 and the last one from bit position 0. If data types larger than a byte are read, they are deserialized as big endian numbers, i.e. byte n-1, then n-2,... 1, 0. String types are read starting with the first character.
Member Summary
Member Functions: bitPos, eof, peek, read, skip, skipToByteStart
Constructors
BitStreamReader
BitStreamReader(
std::istream & inStream
);
Creates the BitStreamReader. Bits are read from inStream.
BitStreamReader
BitStreamReader(
const char * pBuffer,
std::size_t size
);
Creates the BitStreamReader. Bits are read from the given buffer.
Destructor
~BitStreamReader
~BitStreamReader();
Destroys the BitStreamReader.
Member Functions
bitPos
int bitPos() const;
Returns the bit position in relation to the current byte. I.e., numBitsRead % 8
eof
bool eof() const;
Returns true if End-Of-File was encountered.
peek
bool peek(
char & value,
int numBits
);
Peek ahead the number of bits which the next read would return.
peek
bool peek(
Poco::UInt8 & value,
int numBits
);
Peek ahead the number of bits which the next read would return.
read
bool read(
bool & value
);
Reads one single bit from the stream.
read
bool read(
char & value,
int numBits
);
Reads numBits from the stream and puts them as the first bits of value.
Example: Reading the 4 bits 1111b(15d), will result in value = 15.
read
bool read(
std::string & str,
std::size_t numCharacters
);
Clears str and reads the number of defined characters from the stream into str.
read
bool read(
Poco::UInt8 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::UInt16 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::UInt32 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::UInt64 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::Int8 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::Int16 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::Int32 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
read
bool read(
Poco::Int64 & value,
int numBits
);
Reads numBits from the stream and sets them as the lowest numBits bits of value.
skip
void skip(
int n
);
Skips over n bits.
skipToByteStart
void skipToByteStart();
Skips until we are at the beginning of a byte, i.e. bitPos() == 0.