#include "bitstream.h"

class istringbitstream : public ibitstream

This class reads bits of data from string buffers. This class inherits from the ibitstream class.

Available since: 2014/02/01 version of C++ library

Constructors
istringbitstream(s)  Constructs a new bit stream that reads the bytes of the specified string as its input data.
Methods
readBit()  Reads a single bit from the bit stream and returns 0 or 1 depending on the bit value.
str(s)  Sets the underlying string of the bit stream.

Constructor detail


istringbitstream(string s = "");
Constructs a new bit stream that reads the bytes of the specified string as its input data.

Usage:

istringbitstream stream(s);

Method detail


int readBit();
Reads a single bit from the istringbitstream and returns 0 or 1 depending on the bit value. If the stream is exhausted, -1 is returned. Raises an error if this bit stream has not been properly opened.

Usage:

int bit = stream.readBit();

void str(string s);
Sets the underlying string of the bit stream. Future calls to readBit will read bits from the bytes of this string.

Usage:

stream.str(s);