Java 7 Nio Can replace apache.io.FileUtils

Working on a project that was using FileUtils.copy to copy a file from an InputStream to a File.

I decided to investigate the Nio package in Java 7 (and if you’re still using Java 6, please stop). In the docs for Files.copy ([elink link=”http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html”]) was an example of downloading an html page to a file.

It’s very clean and also means I no longer need to depend on an external jar to perform many file operations.

Good bye commons-io. You’ve served me well, but I have a new ‘friend’.