Class FileSystem.Selector

java.lang.Object
org.graalvm.polyglot.io.FileSystem.Selector
All Implemented Interfaces:
Predicate<Path>
Enclosing interface:
FileSystem

public abstract static class FileSystem.Selector extends Object implements Predicate<Path>
A selector for determining which FileSystem should handle operations on a given Path. This class encapsulates a FileSystem and defines a condition for selecting it.
Since:
24.2
  • Constructor Details

  • Method Details

    • getFileSystem

      public final FileSystem getFileSystem()
      Returns the FileSystem associated with this selector.
      Since:
      24.2
    • test

      public abstract boolean test(Path path)
      Tests whether the FileSystem associated with this selector can handle operations on the specified Path.
      Specified by:
      test in interface Predicate<Path>
      Parameters:
      path - the path to test, provided as a normalized absolute path. The given path has no path components equal to "." or "..".
      Returns:
      true if the associated FileSystem can handle the path; false otherwise
      Since:
      24.2
    • of

      public static FileSystem.Selector of(FileSystem fileSystem, Predicate<Path> predicate)
      Creates a FileSystem.Selector for the specified FileSystem using the provided Predicate.
      Parameters:
      fileSystem - the FileSystem to associate with the selector
      predicate - the condition to determine if the FileSystem can handle a given path
      Returns:
      a new FileSystem.Selector that delegates path testing to the predicate
      Since:
      24.2