Java Is Directory Valid isValidDir(String dirName, boolean allowMissing)

Here you can find the source of isValidDir(String dirName, boolean allowMissing)

Description

is Valid Dir

License

Open Source License

Declaration

public static boolean isValidDir(String dirName, boolean allowMissing) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static boolean isValidDir(String dirName, boolean allowMissing) {
        if (dirName == null || dirName.trim().isEmpty()) {
            return false;
        }//  ww  w. j av  a  2s. com

        dirName = dirName.trim();
        File dir = new File(dirName);

        return dir.isDirectory() || (allowMissing && !dir.exists());
    }
}

Related

  1. isValidDir(String dirPath, boolean createDir)
  2. isValidDirectory(File directory)
  3. isValidDirectory(File directory)
  4. isValidDirectory(File f)