code: private static boolean isDirectory(
        SecureDirectoryStream<Path> dir, Path name, LinkOption... options) throws IOException {
      return dir.getFileAttributeView(name, BasicFileAttributeView.class, options)
          .readAttributes()
          .isDirectory();
    }
docs: Returns whether or not the file with the given name in the given dir is a directory.