code: public static boolean isHdfsUri(URI endpoint)
      {
          final String path = endpoint.getPath();
          if (path != null && path.indexOf('/', 1) != -1) {
              return path.substring(1, path.indexOf('/', 1)).equalsIgnoreCase("webhdfs");
          } else {
              return false;
          }
      }
docs: Checks if the given URI is a WebHDFS URL. WebHDFS URLs have the form
  http[s]://hostname:port/webhdfs/v1/.
  
  @param endpoint    The URI
  @return true if it is a WebHDFS URL, false otherwise.