Package com.google.common.jimfs
Class JimfsPath
java.lang.Object
com.google.common.jimfs.JimfsPath
Jimfs implementation of
Path
. Creation of new Path
objects is delegated to the
file system's PathService
.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.common.collect.ImmutableList
<Name> private final PathService
private final @Nullable Name
-
Constructor Summary
ConstructorsConstructorDescriptionJimfsPath
(PathService pathService, @Nullable Name root, Iterable<Name> names) -
Method Summary
Modifier and TypeMethodDescriptionasList()
private @Nullable JimfsPath
int
boolean
boolean
boolean
@Nullable JimfsPath
Equivalent togetFileSystem()
but with a return type ofJimfsFileSystem
.getName
(int index) int
@Nullable JimfsPath
@Nullable JimfsPath
getRoot()
int
hashCode()
boolean
boolean
Returns whether or not this is the empty path, with no root and a single, empty string, name.private boolean
isNormal()
Returns whether or not this path is in a normalized form.iterator()
@Nullable Name
name()
Returns the file name of this path.com.google.common.collect.ImmutableList
<Name> names()
Returns the list of name elements.register
(WatchService watcher, WatchEvent.Kind<?>... events) register
(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) relativize
(Path other) (package private) JimfsPath
Resolves the given name against this path.resolveSibling
(String other) resolveSibling
(Path other) @Nullable Name
root()
Returns the root name, or null if there is no root.boolean
startsWith
(String other) boolean
startsWith
(Path other) private static boolean
startsWith
(List<?> list, List<?> other) Returns true if list starts with all elements of other in the same order.subpath
(int beginIndex, int endIndex) toFile()
toRealPath
(LinkOption... options) toString()
toUri()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
root
-
names
-
pathService
-
-
Constructor Details
-
JimfsPath
-
-
Method Details
-
root
Returns the root name, or null if there is no root. -
names
Returns the list of name elements. -
name
Returns the file name of this path. UnlikegetFileName()
, this may return the name of the root if this is a root path. -
isEmptyPath
public boolean isEmptyPath()Returns whether or not this is the empty path, with no root and a single, empty string, name. -
getFileSystem
- Specified by:
getFileSystem
in interfacePath
-
getJimfsFileSystem
Equivalent togetFileSystem()
but with a return type ofJimfsFileSystem
.getFileSystem()
's return type is left asFileSystem
to make testing paths easier (as long as methods that access the file system in some way are not called, the file system can be a fake file system instance). -
isAbsolute
public boolean isAbsolute()- Specified by:
isAbsolute
in interfacePath
-
getRoot
-
getFileName
- Specified by:
getFileName
in interfacePath
-
getParent
-
getNameCount
public int getNameCount()- Specified by:
getNameCount
in interfacePath
-
getName
-
subpath
-
startsWith
Returns true if list starts with all elements of other in the same order. -
startsWith
- Specified by:
startsWith
in interfacePath
-
startsWith
- Specified by:
startsWith
in interfacePath
-
endsWith
-
endsWith
-
normalize
-
isNormal
private boolean isNormal()Returns whether or not this path is in a normalized form. It's normal if it both contains no "." names and contains no ".." names in a location other than the start of the path. -
resolve
Resolves the given name against this path. The name is assumed not to be a root name. -
resolve
-
resolve
-
resolveSibling
- Specified by:
resolveSibling
in interfacePath
-
resolveSibling
- Specified by:
resolveSibling
in interfacePath
-
relativize
- Specified by:
relativize
in interfacePath
-
toAbsolutePath
- Specified by:
toAbsolutePath
in interfacePath
-
toRealPath
- Specified by:
toRealPath
in interfacePath
- Throws:
IOException
-
register
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException - Specified by:
register
in interfacePath
- Specified by:
register
in interfaceWatchable
- Throws:
IOException
-
register
- Specified by:
register
in interfacePath
- Specified by:
register
in interfaceWatchable
- Throws:
IOException
-
toUri
-
toFile
-
iterator
-
asList
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Path>
- Specified by:
compareTo
in interfacePath
-
equals
-
hashCode
public int hashCode() -
toString
-
checkPath
-