Implement a class named bitoutputstream as shown in figure


Implement a class named BitOutputStream, as shown in Figure for writing bits to an output stream. The writeBit(charbit) method stores the bit in a byte variable. When you create a BitOutputStream, the byte is empty. After invoking writeBit('1'), the byte becomes 00000001. After invoking writeBit("0101"), the byte becomes 00010101. The first three bits are not filled yet. When a byte is full, it is sent to the output stream. Now the byte is reset to empty. You must close the stream by invoking the close() method. If the byte is not empty and not full, the close() method first fills the zeros to make a full 8 bits in the byte, and then output the byte and close the stream.

234_bitoutput.png

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Implement a class named bitoutputstream as shown in figure
Reference No:- TGS01083505

Expected delivery within 24 Hours