Replacing File API by Path API

Issue #17 closed
Markus KARG created an issue

Since Babbler explicitly is a Java 7 based product, it might make sense to replace File API by Path API.

The class File is an anachronism since Java 7: It mixes up referencing a file (hence a path), querying attributes (like directory flags) and accessing the content. Following the paradigm of separation of concerns, it made pretty good sense that Java 7 came up with a replacement in the form of Path API. Using the new Path API, code is getting much cleaner, as separate classes now show directly whether a former use of a File instance is meant to be a path (now an instance of Path), was meant to be a directory modification, or was meant to be concent access (now handled by FileSystem and Files classes). Also, it opens the way for different implements of FileSystems and Files, while the former File class was ubiquitous and rather limited. Ontop of all that, copying, loading and storing files is much simpler and faster using the new Files helper methods.

Comments (3)

  1. Log in to comment