diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java b/src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java index f245cff..bccd403 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java +++ b/src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java @@ -15,19 +15,22 @@ public class FilesystemUtil { */ public static long getFileSizeBytes(String parentDirectory, String fileName) { long fileSize = -1; - try{ + try { File backupZipFile = new File(parentDirectory, fileName); fileSize = backupZipFile.length(); - } catch (SecurityException ignored){ + } catch (SecurityException ignored) { } return fileSize; } public static long getFileSizeBytes(String filePath) { + return getFileSizeBytes(new File(filePath)); + } + + public static long getFileSizeBytes(File file) { long fileSize = -1; try { - File backupZipFile = new File(filePath); - fileSize = backupZipFile.length(); + fileSize = file.length(); } catch (SecurityException ignored) { } return fileSize; |