UNB/ CS/ David Bremner/ teaching/ old/ cs1083/ java/ FileCopy3.java
import java.io.BufferedOutputStream;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileCopy3{

    public static void main(String [] args) throws IOException{
        BufferedInputStream in=
                new BufferedInputStream(new FileInputStream(args[0]));
        BufferedOutputStream out=
                new BufferedOutputStream(new FileOutputStream(args[1]));

        StopWatch clock=new StopWatch();
        long bytes=0;
        clock.start();
        int b=in.read();
        while (b>=0){
            bytes++;
            out.write(b);
            b=in.read();
        }
        clock.stop();
        System.out.println(bytes+" bytes copied in "+
                           clock.getElapsedTime()+"ms");
    }



}
//