(BitOutputStream) Implement a class named BitOutputStream, as shown
in Figure 19.20, for writing bits to an output stream. The writeBit(char
bit) 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. For a hint, see Exercise 4.46. Write a
test program that sends the bits 010000100100001001101 to the file named
Exercise19_17.dat.

The post (bitoutputstream) implement a class named bitoutputstream, as shownin appeared first on essayfount.com.


What Students Are Saying About Us

.......... Customer ID: 12*** | Rating: ⭐⭐⭐⭐⭐
"Honestly, I was afraid to send my paper to you, but you proved you are a trustworthy service. My essay was done in less than a day, and I received a brilliant piece. I didn’t even believe it was my essay at first 🙂 Great job, thank you!"

.......... Customer ID: 11***| Rating: ⭐⭐⭐⭐⭐
"This company is the best there is. They saved me so many times, I cannot even keep count. Now I recommend it to all my friends, and none of them have complained about it. The writers here are excellent."


"Order a custom Paper on Similar Assignment at essayfount.com! No Plagiarism! Enjoy 20% Discount!"


0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *