List of utility methods to do Directory Check
boolean | checkDir(final String dirName) Checks to see if the given directory name corresponds to a directory that exists and can be read. return checkDir(new File(dirName)); |
boolean | checkDir(final String name) Check input directory integrity. return checkDir(new File(name)); |
boolean | checkDir(String dir) check Dir File d = new File(dir); boolean ret = d.exists(); if (ret && d.isFile()) throw new RuntimeException("wrong directory:" + dir); if (!ret) { d.mkdirs(); return ret; ... |
boolean | checkDir(String dir, boolean mustWrite) check Dir File file = new File(dir); if (!file.exists()) throw new IOException("Konnte Verzeichnis " + dir + " nicht finden!"); if (!file.isDirectory()) throw new IOException(dir + " ist kein Verzeichnis!"); if (!file.canRead()) throw new IOException("Verzeichnis " + dir + " ist nicht lesbar!"); if (mustWrite && !file.canWrite()) ... |
String | checkDir(String directory) Checks the given directory for its suffix, ('/' and '\', depending on the detected OS. switch (detectOS()) { case OTHER: System.err.println("[FileUtil : checkDir] Detected OS is not supported."); return null; default: if (!directory.endsWith(File.separator)) { directory += File.separator; return directory; |
boolean | checkDir(String dirName) check Dir File stats = new File(dirName); if (stats.exists()) { return true; } else { if (stats.mkdir()) { return true; } else { return false; ... |
File | checkDir(String name) Check if dir exists File file = new File(name); if (!(file.exists() && file.isDirectory())) { String msg = "No such directory: " + name; throw new IllegalArgumentException(msg); return file; |
void | checkDir(String path) check Dir File file = new File(path); if (!file.exists()) { if (!file.mkdirs()) throw new RuntimeException(String.format("directory %s not create", path)); |
void | checkDir(String path) check Dir File dist = new File(path); if (dist.exists()) { if (!dist.isDirectory()) { dist.renameTo(new File(dist.getPath() + ".swp." + System.currentTimeMillis())); dist.mkdir(); } else { dist.mkdir(); ... |
void | checkDir(String pDir) check Dir File lDir = new File(pDir); if (!lDir.exists()) { if (!lDir.mkdirs()) { throw new Exception("Can not create backup dir: " + pDir); if (!lDir.isDirectory()) { throw new Exception("File exists with name of backup dir: " + pDir); ... |