Java Directory Exist Check checkDir(String dir, boolean mustExist)

Here you can find the source of checkDir(String dir, boolean mustExist)

Description

check Dir

License

Apache License

Declaration

public static void checkDir(String dir, boolean mustExist) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {
    public static void checkDir(String dir, boolean mustExist) {
        File file = new File(dir);
        if ((mustExist && !file.exists()) || file.isFile()) {
            throw new IllegalStateException("must be dir");
        }//w  ww  .  ja va  2s. co  m
    }
}

Related

  1. checkDirectory(String name, boolean createIfNonExistent)
  2. checkDirectoryExists(String path)
  3. checkDirExist(String path)
  4. checkDirExistence(String dir)