Some modules involving data I/O usually perform several required checks before performing input/output operations.
As an instance, they check if a specified file exists/can be read, if a specified path refers to an existing/readable directory, if a specified file is of a specific supported type.
For this reason it will be useful to add some utilities method to the DataUtilities class:
public static boolean checkFileReadable(final File file, final Logger logger):
Checks that a File is a real file, exists and is readable. An optional logger (which can be null) can be specified to get fine logging details.
public static String checkDirectory(String directoryPath)
Checks that the provided directory path refers to an existing/readable directory.
public static IOFileFilter excludeFilters(final IOFileFilter inputFilter, IOFileFilter... filters)
Returns a IOFileFilter obtained by excluding from the first input filter argument, the additional filter rguments.
public static IOFileFilter includeFilters(final IOFileFilter inputFilter, IOFileFilter... filters)
Returns a IOFileFilter obtained by adding to the first input filter argument, the additional filter arguments.
Note that some of these new methods leverage on commons-io and then that dependency should be added to the pom.
The attached patch will allow to add the methods and dependency.