Answer:

End of File

This loop is the familiar read-until-end-of-file idea which is best done using try{} and catch{} blocks.

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

catch ( EOFException  eof )
{
  outstr.close();
  instr.close();
  return;
}

Almost all of the program is here, but there are more details to handle. The one-byte-at-a-time nature of the loop is very inefficient.

QUESTION 16:

How (in general) can IO be made more efficient in this program?