A good answer might be:

DataInputStream and DataOutputStream

Copy Loop

The core of the program looks like this:


    DataInputStream  instr;
    DataOutputStream outstr;
    . . . .
    int data;
    while ( true )
    {
      data = instr.readUnsignedByte() ;
      outstr.writeByte( data ) ;
    }

Repeatedly, one byte at at time is read and written, using the low-order byte of data as an intermediate location.

QUESTION 15:

  • How does the loop end?
  • How should this be handled?
Click Here after you have answered the question