Java Path File Check nio isValidDirectory(String path)

Here you can find the source of isValidDirectory(String path)

Description

Determines whether given path is a valid directory

License

Apache License

Parameter

Parameter Description
path a parameter

Return

true if path is a valid directory

Declaration

public static boolean isValidDirectory(String path) 

Method Source Code

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

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
    /**//from  w ww.  j  a v  a  2  s  .c  o  m
     * Determines whether given path is a valid directory
     * @param path
     * @return true if path is a valid directory
     */
    public static boolean isValidDirectory(String path) {
        return path.length() > 0 & path.charAt(0) == '/'
                & Files.isDirectory(Paths.get(path));
    }
}

Related

  1. isSame(Path expected, Path actual)
  2. isSameFile(Path path1, Path path2)
  3. isSteadyStateReached(Path integrationStepFile, double minStepAtEndOfStabilization)
  4. isUNC(Path inputPath)
  5. isUnix(Path path)
  6. isValidFileType(Path filePath)
  7. isValidHomeDirectory(final Path path)
  8. isValidPath(String path)
  9. isValidPath(String path)