(BitOutputStream) Implement a class named BitOutputStream, as shownin Figure 19.20, for writing bits to an output stream. The writeBit(charbit) method...
(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.
12 years ago
10
Purchase the answer to view it

- src.zip
- power system 2nd assignment HNC (check the questions first-total 10 questions)
- Busi Discussion Board
- Annual Review Report- Assignment 2
- ASMA
- Occupational safety assignment
- To complete this assignment, read through the scenario below and address the specific questions and issues indicated. Review the "Introduction to the Miller Family" document for specific information on each member of the family.
- PSYCH/625 PSYCH 625 Weeks 1-6 Learning Team Assignment - Real Estate Data Analysis - A+& Original Guaranteed!
- LEA 312 Community Policing Ashford University
- bus 401 WEEK 4 individual ASSIGNMENT
- XYZ Trucking Company is evaluating a potential lease agreement on a truck that costs $40,000 and falls into the MACRS 3-year class.