How to well use the java.io and java.nio