Class PathService

  • All Implemented Interfaces:
    java.util.Comparator<JimfsPath>

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

      • 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<java.lang.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<java.lang.Iterable<Name>> CANONICAL_NAMES_ORDERING
      • 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<java.lang.Iterable<Name>> namesOrdering
      • fileSystem

        private volatile java.nio.file.FileSystem fileSystem
      • emptyPath

        private volatile JimfsPath emptyPath
      • NOT_EMPTY

        private static final com.google.common.base.Predicate<java.lang.Object> NOT_EMPTY
    • Method Detail

      • setFileSystem

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

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

        public java.lang.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​(java.lang.String name)
        Returns the Name form of the given string.
      • names

        java.util.List<Name> names​(java.lang.Iterable<java.lang.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​(java.lang.Iterable<Name> names)
        Returns a relative path with the given names.
      • createPath

        public JimfsPath createPath​(@Nullable Name root,
                                    java.lang.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,
                                                     java.lang.Iterable<Name> names)
        Returns a path with the given root (or no root, if null) and the given names.
      • parsePath

        public JimfsPath parsePath​(java.lang.String first,
                                   java.lang.String... more)
        Parses the given strings as a path.
      • toString

        public java.lang.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.
      • toUri

        public java.net.URI toUri​(java.net.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​(java.net.URI uri)
        Converts the path of the given URI into a path for this file system.
      • createPathMatcher

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