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:
parent
1ce8ab15b7
commit
c3895a5852
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user