code: public static int mode(File f) throws PosixException {
          if(Functions.isWindows())   return -1;
          try {
              if (Util.NATIVE_CHMOD_MODE) {
                  return PosixAPI.jnr().stat(f.getPath()).mode();
              } else {
                  return Util.permissionsToMode(Files.getPosixFilePermissions(fileToPath(f)));
              }
          } catch (IOException cause) {
              PosixException e = new PosixException("Unable to get file permissions", null);
              e.initCause(cause);
              throw e;
          }
      }
docs: Gets the mode of a file/directory, if appropriate. Only includes read, write, and
  execute permissions for the owner, group, and others, i.e. the max return value
  is 0777. Consider using {@link Files#getPosixFilePermissions} instead if you only
  care about access permissions.
  <p>If the file is symlink, the mode is that of the link target, not the link itself.
  @return a file mode, or -1 if not on Unix
  @throws PosixException if the file could not be statted, e.g. broken symlink