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 PathServiceprivate final @Nullable Name -
Constructor Summary
ConstructorsConstructorDescriptionJimfsPath(PathService pathService, @Nullable Name root, Iterable<Name> names) -
Method Summary
Modifier and TypeMethodDescriptionasList()private @Nullable JimfsPathintbooleanbooleanboolean@Nullable JimfsPathEquivalent togetFileSystem()but with a return type ofJimfsFileSystem.getName(int index) int@Nullable JimfsPath@Nullable JimfsPathgetRoot()inthashCode()booleanbooleanReturns whether or not this is the empty path, with no root and a single, empty string, name.private booleanisNormal()Returns whether or not this path is in a normalized form.iterator()@Nullable Namename()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) JimfsPathResolves the given name against this path.resolveSibling(String other) resolveSibling(Path other) @Nullable Nameroot()Returns the root name, or null if there is no root.booleanstartsWith(String other) booleanstartsWith(Path other) private static booleanstartsWith(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 interface 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:
getFileSystemin interfacePath
-
getJimfsFileSystem
Equivalent togetFileSystem()but with a return type ofJimfsFileSystem.getFileSystem()'s return type is left asFileSystemto 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:
isAbsolutein interfacePath
-
getRoot
-
getFileName
- Specified by:
getFileNamein interfacePath
-
getParent
-
getNameCount
public int getNameCount()- Specified by:
getNameCountin interfacePath
-
getName
-
subpath
-
startsWith
-
startsWith
- Specified by:
startsWithin interfacePath
-
startsWith
- Specified by:
startsWithin 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
-
resolve
-
resolve
-
resolveSibling
- Specified by:
resolveSiblingin interfacePath
-
resolveSibling
- Specified by:
resolveSiblingin interfacePath
-
relativize
- Specified by:
relativizein interfacePath
-
toAbsolutePath
- Specified by:
toAbsolutePathin interfacePath
-
toRealPath
- Specified by:
toRealPathin interfacePath- Throws:
IOException
-
register
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException - Specified by:
registerin interfacePath- Specified by:
registerin interfaceWatchable- Throws:
IOException
-
register
- Specified by:
registerin interfacePath- Specified by:
registerin interfaceWatchable- Throws:
IOException
-
toUri
-
toFile
-
iterator
-
asList
-
compareTo
-
equals
-
hashCode
-
toString
-
checkPath
-