//copy file conventional way using Stream longstart= System.nanoTime(); copyFileUsingStream(source, dest); System.out.println("Time taken by Stream = "+(System.nanoTime()-start));
//copy files using java.nio FileChannel source = newFile("/Users/pankaj/tmp/sourceChannel.avi"); dest = newFile("/Users/pankaj/tmp/destChannel.avi"); start = System.nanoTime(); copyFileUsingChannel(source, dest); System.out.println("Time taken by Channel = "+(System.nanoTime()-start));
//copy files using apache commons io source = newFile("/Users/pankaj/tmp/sourceApache.avi"); dest = newFile("/Users/pankaj/tmp/destApache.avi"); start = System.nanoTime(); copyFileUsingApacheCommonsIO(source, dest); System.out.println("Time taken by Apache Commons IO = "+(System.nanoTime()-start));
//using Java 7 Files class source = newFile("/Users/pankaj/tmp/sourceJava7.avi"); dest = newFile("/Users/pankaj/tmp/destJava7.avi"); start = System.nanoTime(); copyFileUsingJava7Files(source, dest); System.out.println("Time taken by Java7 Files = "+(System.nanoTime()-start)); } }