List of utility methods to do Directory Check
void | checkDirAndCreate(File dir) Checks a directory for existence and creates it if non-existent. if (!dir.exists())
dir.mkdirs();
|
void | checkDirCopy(File srcDir, File destDir) check Dir Copy if (!srcDir.exists()) { throw new FileNotFoundException("Source '" + srcDir + "' does not exist."); if (!srcDir.isDirectory()) { throw new IOException("Source '" + srcDir + "' is not a directory."); if (equals(srcDir, destDir)) { throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are the same."); ... |
void | checkDirectory(File dir) Check local directory. if (!dir.exists()) if (!dir.mkdirs()) throw new IllegalArgumentException("!dir.mkdirs(), dir=" + dir); if (!dir.isDirectory()) throw new IllegalArgumentException("dir (=" + dir + ") is not a directory."); |
void | checkDirectory(File directory) check Directory if (!directory.isDirectory()) { throw new IllegalArgumentException(directory.getAbsolutePath() + " is not a directory"); |
void | checkDirectory(File directory) Checks that the given File exists and is a directory. if (!directory.exists()) { throw new IllegalArgumentException(directory + " does not exist"); if (!directory.isDirectory()) { throw new IllegalArgumentException(directory + " is not a directory"); |
void | checkDirectory(File directory) check Directory if (!directory.exists() && !directory.mkdirs()) { throw new IOException("Could not create directory! " + directory); if (!directory.isDirectory()) { throw new IOException("Directory is not a directory! " + directory); if (!directory.canRead() || !directory.canWrite()) { throw new IOException("Can not read from or write into directory! " + directory); ... |
void | checkDirectory(File directory, String pckgname, ArrayList Private helper method File tmpDirectory; if (directory.exists() && directory.isDirectory()) { final String[] files = directory.list(); for (final String file : files) { if (file.endsWith(".class")) { try { classes.add(Class.forName(pckgname + '.' + file.substring(0, file.length() - 6))); } catch (final NoClassDefFoundError e) { ... |
File | checkDirectory(File file) Checks that the provided directory path refers to an existing/readable directory. String directoryPath = file.getPath(); File inDir = file; if (!inDir.isDirectory()) { throw new IllegalArgumentException("Not a directory: " + directoryPath); if (!inDir.canRead()) { throw new IllegalArgumentException("Not a writable directory: " + directoryPath); try { directoryPath = inDir.getCanonicalPath(); } catch (IOException e) { throw new IllegalArgumentException(e); inDir = new File(directoryPath); if (!inDir.isDirectory()) { throw new IllegalArgumentException("Not a directory: " + directoryPath); if (!inDir.canRead()) { throw new IllegalArgumentException("Not a writable directory: " + directoryPath); return new File(directoryPath); |
void | checkDirectory(File target) check Directory if (target == null) { throw new IllegalArgumentException("argument must not be null."); if (target.isFile()) { throw new IllegalArgumentException("argument must be directory. [" + target.getAbsolutePath() + "]"); |
void | checkDirectory(final File directory) check Directory if (directory.exists()) { if (!directory.isDirectory()) { throw new IOException(directory + " is not a directory"); } else { throw new IOException(directory + " doesn't exist"); |