DataInputStream
and DataOutputStream
DataInputStream instr;
DataOutputStream outstr;
. . . .
int data;
while ( true )
{
data = instr.readUnsignedByte() ;
outstr.writeByte( data ) ;
}
The main loop of the program repeatedly reads a byte from the input file and then writes that byte to the output file.
The low-order byte of the integer variable data
holds the byte that is read from the input file and written to the output file.