List of utility methods to do Directory Check
void | checkDirectory(final String dir, final boolean create, final String errorDirName) Check that a directory is valid. try { checkDirectory(dir, create); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(errorDirName + ": " + e.getMessage()); |
boolean | checkDirectory(String value) check Directory boolean isWriteable = false; File file = new File(value); if (file.isDirectory() && file.canWrite()) { System.out.println(" \n:Able to write to the directory: " + file.getName()); isWriteable = true; } else { System.out.println(" \n:Cannot write to the directory " + value); return isWriteable; |
int | checkDirectoryArray(String[] names) Checks a array of names for non existent or non directory entries and nulls them out. int count = 0; for (int i = 0; i < names.length; i++) { if (names[i] != null) { File dir = new File(names[i]); if (dir.exists() && dir.isDirectory()) { count++; } else { names[i] = null; ... |
boolean | checkDirectoryInWorkspace(String directoryName) Check whether there is a directory existing in present workspace, with the given name. boolean retVal = false; File file = null; try { file = new File(getWorkspacePath() + directoryName); } catch (Exception exp) { if ((file != null) && (file.exists()) && (file.isDirectory())) { retVal = true; ... |
File | checkDirPath(final String path) check Dir Path final File dir = new File(path); if (!dir.exists()) { throw new IOException("Directory does not exist: " + path); if (!dir.isDirectory()) { throw new IOException("Path does not point to a directory: " + path); return dir; ... |
void | checkDirs(File f) Make parent directories of the given file if no existing. if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
|
void | checkDirs(String dir) check Dirs File file = new File(dir); if (!file.exists()) { file.mkdirs(); |
File | checkDirs(String dirName) Check if dir exists. File dir = new File(dirName); if (!dir.exists()) { dir.mkdirs(); return dir; |