A good answer might be:

By using buffered input and buffered output.

Buffering

The stream types BufferedInputStream and BufferedOutputStream each put a buffer between the program and the disk. The program logic deals with single bytes; actual IO is done efficiently.


DataInputStream  instr;
DataOutputStream outstr;
. . . .
instr = 
  new DataInputStream(
    new BufferedInputStream(
      new FileInputStream( args[0] )));

outstr = 
  new DataOutputStream(
    new BufferedOutputStream(
      new FileOutputStream( args[2] )));

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

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

The names of the files come from the command line. The name of the file to be copied is argument number 0; the copy is argument number 2 (the word "to" is argument number 1).

QUESTION 17:

But now there is something else that needs to be handled. What is it?