From 4c77950f3670e311f1a78cad66045f4d2e659dff Mon Sep 17 00:00:00 2001 From: nathan Date: Sat, 29 Jul 2017 23:07:41 +0200 Subject: [PATCH] FileUtil.moveFile now supports all permutations --- src/dorkbox/util/FileUtil.java | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/dorkbox/util/FileUtil.java b/src/dorkbox/util/FileUtil.java index c45655f..d89cbea 100644 --- a/src/dorkbox/util/FileUtil.java +++ b/src/dorkbox/util/FileUtil.java @@ -424,19 +424,28 @@ class FileUtil { return one; } + /** + * Moves a file, overwriting any existing file at the destination. + */ + public static + File moveFile(String in, File out) throws IOException { + return moveFile(new File(in), out); + } + + /** + * Moves a file, overwriting any existing file at the destination. + */ + public static + File moveFile(File in, String out) throws IOException { + return moveFile(in, new File(out)); + } + /** * Moves a file, overwriting any existing file at the destination. */ public static File moveFile(String in, String out) throws IOException { - if (in == null || in.isEmpty()) { - throw new IllegalArgumentException("in cannot be null."); - } - if (out == null || out.isEmpty()) { - throw new IllegalArgumentException("out cannot be null."); - } - return moveFile(new File(in), new File(out)); }