1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-15 05:45:05 -05:00

* added file create helper function

This commit is contained in:
Reinhard Pointner 2015-03-25 05:18:35 +00:00
parent 1ce8ab15b7
commit c3895a5852

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);