diff options
author | Keuin <[email protected]> | 2021-01-25 15:25:34 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2021-01-25 15:25:34 +0800 |
commit | 08ac6aaea58b7309ea95a12ca6227a6ca3ce4db5 (patch) | |
tree | d305fc23d2cec9935ccb5e5a5390c9d5e54a8726 /src/main/java/com/keuin/kbackupfabric/util/FilesystemUtil.java | |
parent | a817715ad4f625e355b285d67ee323e8b2006ae4 (diff) |
Improve user interaction.
Code refactor.
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; |