List of utility methods to do File Exist
boolean | exists(String path) exists return new File(path).exists(); |
Boolean | fileExists(String path) file Exists return new File(path).isFile(); |
Boolean | fileOrPathExists(String path) file Or Path Exists File f = new File(path); return f.exists(); |
File | getExistingFile(String path, boolean mustBeReadable, boolean mustBeWritable, boolean isDirectory) gets a file that exists and matches the requested permissions or throws an exception checks if it s a file or a directory File file = getExistingFile(path, mustBeReadable, mustBeWritable); if (file.isDirectory() && !isDirectory) throw new IOException(file.getAbsolutePath() + " exists but is not a file"); if (!file.isDirectory() && isDirectory) throw new IOException(file.getAbsolutePath() + " exists but is not a directory"); return file; ... |
boolean | isExist(String path) is Exist return new File(path).exists(); |
boolean | isFileExist(String fileName) is File Exist File file = new File(fileName); return file.exists(); |
boolean | isFileExist(String fileName) is File Exist boolean bool = false; bool = new File(fileName).exists(); return bool; |
boolean | isFileExist(String folder, String fileName) is File Exist boolean bool = false; bool = new File(folder, fileName).exists(); return bool; |
boolean | isFileExist(String path) is File Exist File temp = new File(path); return temp.exists(); |
boolean | isFileExist(String path) is File Exist boolean exist = false; if (path != null) { File f = new File(path); exist = f.exists(); return exist; |