Package com.google.common.jimfs
Class PathService
- java.lang.Object
-
- com.google.common.jimfs.PathService
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Comparator<java.lang.Iterable<Name>>CANONICAL_NAMES_COMPARATORprivate static java.util.Comparator<Name>CANONICAL_ROOT_COMPARATORprivate com.google.common.collect.ImmutableSet<PathNormalization>canonicalNormalizationsprivate static java.util.Comparator<java.lang.Iterable<Name>>DISPLAY_NAMES_COMPARATORprivate static java.util.Comparator<Name>DISPLAY_ROOT_COMPARATORprivate com.google.common.collect.ImmutableSet<PathNormalization>displayNormalizationsprivate JimfsPathemptyPathprivate booleanequalityUsesCanonicalFormprivate java.nio.file.FileSystemfileSystemprivate java.util.Comparator<java.lang.Iterable<Name>>namesComparatorprivate static com.google.common.base.Predicate<java.lang.Object>NOT_EMPTYprivate java.util.Comparator<Name>rootComparatorprivate PathTypetype
-
Constructor Summary
Constructors Constructor Description PathService(Configuration config)PathService(PathType type, java.lang.Iterable<PathNormalization> displayNormalizations, java.lang.Iterable<PathNormalization> canonicalNormalizations, boolean equalityUsesCanonicalForm)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(JimfsPath a, JimfsPath b)JimfsPathcreateFileName(Name name)Returns a single filename path with the given name.JimfsPathcreatePath(@Nullable Name root, java.lang.Iterable<Name> names)Returns a path with the given root (or no root, if null) and the given names.protected JimfsPathcreatePathInternal(@Nullable Name root, java.lang.Iterable<Name> names)Returns a path with the given root (or no root, if null) and the given names.java.nio.file.PathMatchercreatePathMatcher(java.lang.String syntaxAndPattern)Returns aPathMatcherfor the given syntax and pattern as specified byFileSystem.getPathMatcher(String).JimfsPathcreateRelativePath(java.lang.Iterable<Name> names)Returns a relative path with the given names.JimfsPathcreateRoot(Name root)Returns a root path with the given name.JimfsPathemptyPath()Returns an empty path which has a single name, the empty string.JimfsPathfromUri(java.net.URI uri)Converts the path of the given URI into a path for this file system.java.nio.file.FileSystemgetFileSystem()Returns the file system this service is for.java.lang.StringgetSeparator()Returns the default path separator.inthash(JimfsPath path)Creates a hash code for the given path.Namename(java.lang.String name)Returns theNameform of the given string.(package private) java.util.List<Name>names(java.lang.Iterable<java.lang.String> names)Returns theNameforms of the given strings.JimfsPathparsePath(java.lang.String first, java.lang.String... more)Parses the given strings as a path.voidsetFileSystem(java.nio.file.FileSystem fileSystem)Sets the file system to use for created paths.private JimfsPathtoPath(PathType.ParseResult parsed)java.lang.StringtoString(JimfsPath path)Returns the string form of the given path.java.net.URItoUri(java.net.URI fileSystemUri, JimfsPath path)Returns the URI for the given path.
-
-
-
Field Detail
-
DISPLAY_ROOT_COMPARATOR
private static final java.util.Comparator<Name> DISPLAY_ROOT_COMPARATOR
-
DISPLAY_NAMES_COMPARATOR
private static final java.util.Comparator<java.lang.Iterable<Name>> DISPLAY_NAMES_COMPARATOR
-
CANONICAL_ROOT_COMPARATOR
private static final java.util.Comparator<Name> CANONICAL_ROOT_COMPARATOR
-
CANONICAL_NAMES_COMPARATOR
private static final java.util.Comparator<java.lang.Iterable<Name>> CANONICAL_NAMES_COMPARATOR
-
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
-
rootComparator
private final java.util.Comparator<Name> rootComparator
-
namesComparator
private final java.util.Comparator<java.lang.Iterable<Name>> namesComparator
-
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
-
-
Constructor Detail
-
PathService
PathService(Configuration config)
-
PathService
PathService(PathType type, java.lang.Iterable<PathNormalization> displayNormalizations, java.lang.Iterable<PathNormalization> canonicalNormalizations, boolean equalityUsesCanonicalForm)
-
-
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.
-
names
java.util.List<Name> names(java.lang.Iterable<java.lang.String> names)
Returns theNameforms of the given strings.
-
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.
-
toPath
private JimfsPath toPath(PathType.ParseResult parsed)
-
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.
-
compare
public int compare(JimfsPath a, JimfsPath b)
- Specified by:
comparein interfacejava.util.Comparator<JimfsPath>
-
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 aPathMatcherfor the given syntax and pattern as specified byFileSystem.getPathMatcher(String).
-
-