Java Utililty Methods Path File Check nio

List of utility methods to do Path File Check nio

Description

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

Method

booleanisJniNativeFunction(Path path)
is Jni Native Function
if (!path.toString().endsWith("h"))
    return false;
for (String line : Files.readAllLines(path, Charset.defaultCharset()))
    if (line.contains("/* Header for class"))
        return true;
return false;
booleanisJSON(final Path file)
is JSON
if (getExtension(file).equals("png") || getExtension(file).equals("wav") || getExtension(file).equals("ogg")
        || getExtension(file).equals("txt") || getExtension(file).equals("lua")
        || getExtension(file).equals("ttf")) {
    return false;
return true;
booleanisJsonFile(Path filePath)
is Json File
return (Files.isRegularFile(filePath) && filePath.toString().toLowerCase().endsWith(JSON_EXT));
booleanisOva(final Path filePath)
is Ova
return ovaMatcher.matches(filePath);
booleanisParent(Path parent, Path child)
is Parent
parent = parent.normalize().toAbsolutePath();
child = child.normalize().toAbsolutePath();
return child.getNameCount() > parent.getNameCount() && child.startsWith(parent);
booleanisParent(Path parent, Path path)
is Parent
while ((path = path.getParent()) != null) {
    if (path.equals(parent)) {
        return true;
return false;
booleanisParentOf(Path possibleParent, Path possibleChild)
Determine if one path is a child of another.
return possibleChild.startsWith(possibleParent);
booleanisPath(Class clazz)
is Path
if (pathClass == null && !pathClass_error) {
    try {
        pathClass = Class.forName("java.nio.file.Path");
    } catch (Throwable ex) {
        pathClass_error = true;
if (pathClass != null) {
...
booleanisPermission(Path p, Function function)
is Permission
Objects.requireNonNull(p);
Objects.requireNonNull(function);
return function.apply(p);
booleanisPictureFile(Path file)
is Picture File
return file.toString().toLowerCase().endsWith(".png") || file.toString().toLowerCase().endsWith(".jpg")
        || file.toString().toLowerCase().endsWith(".jpeg") || file.toString().toLowerCase().endsWith(".bmp")
        || file.toString().toLowerCase().endsWith(".gif") || file.toString().toLowerCase().endsWith(".tif")
        || file.toString().toLowerCase().endsWith(".tiff")
        || file.toString().toLowerCase().endsWith(".ico");