This class is designed for handle file and directory reading, writing, setting in a simple and effective way.
Most of its functions are delegated to platform operations by the JVM which makes them platform-independent.
The methods have connections towards InputStream, OutputStream, BufferedReader, BufferedWriter and Iterable (reaches all Collection classes which implement it e.g. List).
EXAMPLE FOR READING FILE:
EXAMPLE FOR WRITING FILE:
The OpenOption is an interface. The StandardOpenOption implements it and serves constants which define how to open a file. Use this class with e.g. reading or writing file content.
Typical constant combinations:
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING (upon opening, create if non-existent, truncate content to zero if exists)
StandardOpenOption.CREATE, StandardOpenOption.APPEND (upon opening, create if non-existent, append if exists)
In order to visit and manipulate all files in hierarchy under a certain root directory, Files offers the walkFileTree() method.
In order to use this method, extending the SimpleFileVisitor generic class is needed.
EXAMPLE FOR WALKFILETREE (COPY OR MOVE):
EXAMPLE FOR EXTENDING SIMPLEFILEVISITOR (COPY-MOVE TREE):