From adf55b68a027053bffebd92aac4ba5c1187697f3 Mon Sep 17 00:00:00 2001 From: Notmoo Date: Mon, 31 Jul 2017 18:58:56 +0200 Subject: [PATCH] =?UTF-8?q?Module=20Server,=20clss=20FileUtil=20:=20r?= =?UTF-8?q?=C3=A9arrangement=20contenu=20de=20la=20clss=20+=20javadoc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../classes/com/pqt/server/tools/FileUtil.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Workspace/server/src/main/WEB-INF/classes/com/pqt/server/tools/FileUtil.java b/Workspace/server/src/main/WEB-INF/classes/com/pqt/server/tools/FileUtil.java index 1a0fc195..54a5d349 100644 --- a/Workspace/server/src/main/WEB-INF/classes/com/pqt/server/tools/FileUtil.java +++ b/Workspace/server/src/main/WEB-INF/classes/com/pqt/server/tools/FileUtil.java @@ -7,6 +7,13 @@ import java.nio.file.Paths; public class FileUtil { + /** + * @see #createFileIfNotExist(Path) + */ + public static boolean createFileIfNotExist(String filePath) throws IOException { + return createFileIfNotExist(Paths.get(filePath)); + } + /** * Check if the given file path correspond to an existing file, and create it if it doesn't. * @@ -15,16 +22,15 @@ public class FileUtil { * @return {@code true} if the file has been created, {@code false} if it already existed. * @throws IOException if any IOException happend during this method's execution. */ - public static boolean createFileIfNotExist(String filePath) throws IOException { + public static boolean createFileIfNotExist(Path filePath) throws IOException { if(FileUtil.exist(filePath)){ - Path path = Paths.get(filePath); - Files.createFile(path); + Files.createFile(filePath); return true; } return false; } - public static boolean exist(String filePath) { - return Files.exists(Paths.get(filePath)); + public static boolean exist(Path path) { + return Files.exists(path); } }