Java Utililty Methods Path Exist nio

List of utility methods to do Path Exist nio

Description

The list of methods to do Path Exist nio are organized into topic(s).

Method

booleanexists(Path... files)
Returns true iff one of the files exists otherwise false
for (Path file : files) {
    if (Files.exists(file)) {
        return true;
return false;
booleanexists(String path)
Answers if the given path denotes existing directory.
if (path == null)
    return false;
Path p = Paths.get(path);
return Files.exists(p) && Files.isDirectory(p) && Files.isReadable(p);
booleanexistsAndIsDirectory(Path path)
exists And Is Directory
return Files.exists(path) && Files.isDirectory(path);
booleanfileExists(Path path)
file Exists
return path.toFile().exists();
PathgetNonExisting(Path path)
get Non Existing
if (!Files.exists(path)) {
    return path;
final String name = path.getFileName().toString();
final int fileTypeIndex = name.lastIndexOf(".");
String nameWithoutExtension;
String extension;
if (fileTypeIndex == -1) {
...
BooleanisExists(final Path path)
is Exists
return path.toFile().exists();
booleanisFileExists(Path file)
is File Exists
return Files.exists(file) && Files.isRegularFile(file);
booleanlenientExists(Path file)
lenient Exists
boolean exists = false;
try {
    exists = Files.exists(file);
} catch (SecurityException ok) {
return exists;
PathmakeTempFilePath(boolean exists)
make Temp File Path
Path result;
if (System.getenv().containsKey("TEST_TMPDIR")) {
    result = Files.createTempFile(Paths.get(System.getenv("TEST_TMPDIR")), "", "json");
} else {
    result = Files.createTempFile("", "json");
if (!exists) {
    Files.delete(result);
...