FileCopy1.javaimport java.io.*;
class FileCopy1 {
public static void main( String[] args )
{
int ch = 0;
if ( args.length != 2 ) {
System.err.println( "usage: java FileCopy source dest" );
System.exit( 0 );
}
try (
FileInputStream in = new FileInputStream( args[0] );
FileOutputStream out = new FileOutputStream( args[1] );
)
{
while ( true ) {
ch = in.read();
if (ch == -1) break;
out.write(ch);
}
out.close();
in.close();
} catch (IOException e) {
System.err.println( "IO error "+e );
}
}
}
Maintained by John Loomis, updated Mon Feb 04 15:08:39 2019