mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-23 07:51:08 +00:00
Module Server, clss FileUtil : réarrangement contenu de la clss + javadoc
This commit is contained in:
parent
a6415ac494
commit
adf55b68a0
@ -7,6 +7,13 @@ import java.nio.file.Paths;
|
|||||||
|
|
||||||
public class FileUtil {
|
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.
|
* 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.
|
* @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.
|
* @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)){
|
if(FileUtil.exist(filePath)){
|
||||||
Path path = Paths.get(filePath);
|
Files.createFile(filePath);
|
||||||
Files.createFile(path);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean exist(String filePath) {
|
public static boolean exist(Path path) {
|
||||||
return Files.exists(Paths.get(filePath));
|
return Files.exists(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user