code: public static int getMode(String path) {
      if (path == null) {
        return 0;
      }
  
      File file = new File(path);
      if (file.isDirectory()) {
        return S_IFDIR_VALUE;
      }
      if (file.isFile()) {
        return S_IFREG_VALUE;
      }
      if (!canonicalize(path).equals(path)) {
        return S_IFLNK_VALUE;
      }
      return 0;
    }
docs: Returns the st_mode for the path.