Java Path File Check nio isJSON(final Path file)

Here you can find the source of isJSON(final Path file)

Description

is JSON

License

Open Source License

Declaration

public static boolean isJSON(final Path file) 

Method Source Code

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

import java.nio.file.Path;

public class Main {
    public static boolean isJSON(final Path file) {

        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;
        }//from w ww  .  j  ava 2  s.  c  o  m

        return true;

    }

    public static String getExtension(final Path path) {

        int i = path.toString().lastIndexOf(".");

        if (i >= 0) {
            return path.toString().substring(i + 1);
        }

        return "";

    }
}

Related

  1. isHidden(final Path path)
  2. isHidden(Path path)
  3. isHidden(Path path)
  4. isHidden(Path value)
  5. isJniNativeFunction(Path path)
  6. isJsonFile(Path filePath)
  7. isOva(final Path filePath)
  8. isParent(Path parent, Path child)
  9. isParent(Path parent, Path path)