Class PathService

java.lang.Object
com.google.common.jimfs.PathService
All Implemented Interfaces:
Comparator<JimfsPath>

final class PathService extends Object implements Comparator<JimfsPath>
Service for creating JimfsPath instances and handling other path-related operations.
  • Field Details

    • DISPLAY_ROOT_ORDERING

      private static final com.google.common.collect.Ordering<Name> DISPLAY_ROOT_ORDERING
    • DISPLAY_NAMES_ORDERING

      private static final com.google.common.collect.Ordering<Iterable<Name>> DISPLAY_NAMES_ORDERING
    • CANONICAL_ROOT_ORDERING

      private static final com.google.common.collect.Ordering<Name> CANONICAL_ROOT_ORDERING
    • CANONICAL_NAMES_ORDERING

      private static final com.google.common.collect.Ordering<Iterable<Name>> CANONICAL_NAMES_ORDERING
    • type

      private final PathType type
    • displayNormalizations

      private final com.google.common.collect.ImmutableSet<PathNormalization> displayNormalizations
    • canonicalNormalizations

      private final com.google.common.collect.ImmutableSet<PathNormalization> canonicalNormalizations
    • equalityUsesCanonicalForm

      private final boolean equalityUsesCanonicalForm
    • rootOrdering

      private final com.google.common.collect.Ordering<Name> rootOrdering
    • namesOrdering

      private final com.google.common.collect.Ordering<Iterable<Name>> namesOrdering
    • fileSystem

      private volatile FileSystem fileSystem
    • emptyPath

      private volatile JimfsPath emptyPath
    • NOT_EMPTY

      private static final com.google.common.base.Predicate<Object> NOT_EMPTY
  • Constructor Details

  • Method Details

    • setFileSystem

      public void setFileSystem(FileSystem fileSystem)
      Sets the file system to use for created paths.
    • getFileSystem

      public FileSystem getFileSystem()
      Returns the file system this service is for.
    • getSeparator

      public String getSeparator()
      Returns the default path separator.
    • emptyPath

      public JimfsPath emptyPath()
      Returns an empty path which has a single name, the empty string.
    • name

      public Name name(String name)
      Returns the Name form of the given string.
    • names

      List<Name> names(Iterable<String> names)
      Returns the Name forms of the given strings.
    • createRoot

      public JimfsPath createRoot(Name root)
      Returns a root path with the given name.
    • createFileName

      public JimfsPath createFileName(Name name)
      Returns a single filename path with the given name.
    • createRelativePath

      public JimfsPath createRelativePath(Iterable<Name> names)
      Returns a relative path with the given names.
    • createPath

      public JimfsPath createPath(@Nullable Name root, Iterable<Name> names)
      Returns a path with the given root (or no root, if null) and the given names.
    • createPathInternal

      protected final JimfsPath createPathInternal(@Nullable Name root, Iterable<Name> names)
      Returns a path with the given root (or no root, if null) and the given names.
    • parsePath

      public JimfsPath parsePath(String first, String... more)
      Parses the given strings as a path.
    • toPath

      private JimfsPath toPath(PathType.ParseResult parsed)
    • toString

      public String toString(JimfsPath path)
      Returns the string form of the given path.
    • hash

      public int hash(JimfsPath path)
      Creates a hash code for the given path.
    • compare

      public int compare(JimfsPath a, JimfsPath b)
      Specified by:
      compare in interface Comparator<JimfsPath>
    • toUri

      public URI toUri(URI fileSystemUri, JimfsPath path)
      Returns the URI for the given path. The given file system URI is the base against which the path is resolved to create the returned URI.
    • fromUri

      public JimfsPath fromUri(URI uri)
      Converts the path of the given URI into a path for this file system.
    • createPathMatcher

      public PathMatcher createPathMatcher(String syntaxAndPattern)
      Returns a PathMatcher for the given syntax and pattern as specified by FileSystem.getPathMatcher(String).