Interface PathVisit


public interface PathVisit
Provides context for a given path visit
  • Method Summary

    Modifier and Type
    Method
    Description
    The path being visited.
    default String
    Path relative to the root of the tree as a string with / as a path element separator.
    Path relative to the root of the tree as a string with a provided path element separator.
    The root of the path tree the current path belongs to.
    default URL
    URL that can be used to read the content of the path.
    void
    Terminates walking over a PathTree after this visit.
  • Method Details

    • getRoot

      Path getRoot()
      The root of the path tree the current path belongs to. For a PathTree created for an archive, this will be the path to the archive file. For a PathTree created for a directory, this will be the path to the directory.
      Returns:
      root of the path tree the current path belongs to
    • getPath

      Path getPath()
      The path being visited. The FileSystem the path belongs to will depend on the implementation of the PathTree being visited. For example, for an archive it will be a ZIP FileSystem implementation. The returned path is granted to exist in the underlying file system (unless it was deleted by a parallel process or thread) and therefore it can be used for I/O operations straight away without further resolving, e.g. against getRoot()
      Returns:
      path being visited
    • getUrl

      default URL getUrl()
      URL that can be used to read the content of the path.
      Returns:
      URL that can be used to read the content of the path
    • getRelativePath

      default String getRelativePath()
      Path relative to the root of the tree as a string with / as a path element separator. This method calls getRelativePath(String) passing / as an argument.
      Returns:
      path relative to the root of the tree as a string with / as a path element separator
    • getRelativePath

      String getRelativePath(String separator)
      Path relative to the root of the tree as a string with a provided path element separator. For a PathTree created for an archive, the returned path will be relative to the root of the corresponding FileSystem implementation. For a PathTree created for a directory, the returned path will be relative to the directory used as the root of the path tree.
      Parameters:
      separator - path element separator
      Returns:
      path relative to the root of the tree as a string with a provided path element separator
    • stopWalking

      void stopWalking()
      Terminates walking over a PathTree after this visit.