1 3 import java.io.*; 4 import java.util.*; 5 6 public class Copy { 7 8 public static void main( String args[] ) throws IOException 9 { 10 if (args.length != 2) 11 throw new RuntimeException ( "USAGE: Copy <srcfile> <dstfile>" ); 12 FileInputStream fin = new FileInputStream( args[0] ); 13 FileOutputStream fout = new FileOutputStream( args[1] ); 14 15 byte buffer[] = new byte[8192]; 16 17 int n; 18 while ( (n = fin.read( buffer )) > -1 ) 19 fout.write( buffer, 0, n ); 20 21 fout.close(); 22 fin.close(); 23 System.out.println( "DONE" ); 24 } 25 } 26 27 29 | Popular Tags |