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 com.google.common.collect.Ordering<java.lang.Iterable<Name>>
CANONICAL_NAMES_ORDERING
private static com.google.common.collect.Ordering<Name>
CANONICAL_ROOT_ORDERING
private com.google.common.collect.ImmutableSet<PathNormalization>
canonicalNormalizations
private static com.google.common.collect.Ordering<java.lang.Iterable<Name>>
DISPLAY_NAMES_ORDERING
private static com.google.common.collect.Ordering<Name>
DISPLAY_ROOT_ORDERING
private com.google.common.collect.ImmutableSet<PathNormalization>
displayNormalizations
private JimfsPath
emptyPath
private boolean
equalityUsesCanonicalForm
private java.nio.file.FileSystem
fileSystem
private com.google.common.collect.Ordering<java.lang.Iterable<Name>>
namesOrdering
private static com.google.common.base.Predicate<java.lang.Object>
NOT_EMPTY
private com.google.common.collect.Ordering<Name>
rootOrdering
private PathType
type
-
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 int
compare(JimfsPath a, JimfsPath b)
JimfsPath
createFileName(Name name)
Returns a single filename path with the given name.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.protected 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.java.nio.file.PathMatcher
createPathMatcher(java.lang.String syntaxAndPattern)
Returns aPathMatcher
for the given syntax and pattern as specified byFileSystem.getPathMatcher(String)
.JimfsPath
createRelativePath(java.lang.Iterable<Name> names)
Returns a relative path with the given names.JimfsPath
createRoot(Name root)
Returns a root path with the given name.JimfsPath
emptyPath()
Returns an empty path which has a single name, the empty string.JimfsPath
fromUri(java.net.URI uri)
Converts the path of the given URI into a path for this file system.java.nio.file.FileSystem
getFileSystem()
Returns the file system this service is for.java.lang.String
getSeparator()
Returns the default path separator.int
hash(JimfsPath path)
Creates a hash code for the given path.Name
name(java.lang.String name)
Returns theName
form of the given string.(package private) java.util.List<Name>
names(java.lang.Iterable<java.lang.String> names)
Returns theName
forms of the given strings.JimfsPath
parsePath(java.lang.String first, java.lang.String... more)
Parses the given strings as a path.void
setFileSystem(java.nio.file.FileSystem fileSystem)
Sets the file system to use for created paths.private JimfsPath
toPath(PathType.ParseResult parsed)
java.lang.String
toString(JimfsPath path)
Returns the string form of the given path.java.net.URI
toUri(java.net.URI fileSystemUri, JimfsPath path)
Returns the URI for the given path.
-
-
-
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
-
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<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
-
-
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 theName
forms 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:
compare
in 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 aPathMatcher
for the given syntax and pattern as specified byFileSystem.getPathMatcher(String)
.
-
-