* added file create helper function

This commit is contained in:
Reinhard Pointner 2015-03-25 05:18:35 +00:00
parent 1ce8ab15b7
commit c3895a5852
1 changed files with 11 additions and 0 deletions

View File

@ -156,6 +156,17 @@ public final class FileUtilities {
return org.apache.commons.io.FileUtils.deleteQuietly(file);
}
public static File createFileIfNotExists(File file) throws IOException {
if (file.isFile()) {
return file;
}
// create parent folder structure if necessary
Files.createDirectories(file.getParentFile().toPath());
// create file
return Files.createFile(file.toPath()).toFile();
}
public static byte[] readFile(File source) throws IOException {
InputStream in = new FileInputStream(source);