@ParametersAreNonnullByDefault public final class GenericPath extends Object implements Path
Path
implementation
IMPORTANT: unlike the definition of Path
, an
empty path has no name elements. In theory, an empty path is a path with a
single, empty name element, but this is an outright bug, since no filesystem
suports empty name elements. At the moment is it NOT planned to "fix" this.
Most of the heavy lifting of path manipulation (resolution, parent etc)
is delegated to the PathElementsFactory
provided as an argument to
the constructor, which is why this class can be made final
.
You won't want to create instances of this class directly; use FileSystem.getPath(String, String...)
instead.
PathElementsFactory
,
PathElements
Constructor and Description |
---|
GenericPath(GenericFileSystem fs,
PathElementsFactory factory,
PathElements elements)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Path other) |
boolean |
endsWith(Path other) |
boolean |
endsWith(String other) |
boolean |
equals(Object obj) |
Path |
getFileName() |
FileSystem |
getFileSystem() |
Path |
getName(int index) |
int |
getNameCount() |
Path |
getParent() |
Path |
getRoot() |
int |
hashCode() |
boolean |
isAbsolute() |
Iterator<Path> |
iterator() |
Path |
normalize() |
WatchKey |
register(WatchService watcher,
WatchEvent.Kind<?>... events) |
WatchKey |
register(WatchService watcher,
WatchEvent.Kind<?>[] events,
WatchEvent.Modifier... modifiers) |
Path |
relativize(Path other) |
Path |
resolve(Path other) |
Path |
resolve(String other) |
Path |
resolveSibling(Path other) |
Path |
resolveSibling(String other) |
boolean |
startsWith(Path other) |
boolean |
startsWith(String other) |
Path |
subpath(int beginIndex,
int endIndex) |
Path |
toAbsolutePath() |
File |
toFile() |
Path |
toRealPath(LinkOption... options) |
String |
toString() |
URI |
toUri() |
public GenericPath(GenericFileSystem fs, PathElementsFactory factory, PathElements elements)
fs
- the file system this path is issued fromfactory
- the path elements factoryelements
- the path elementspublic FileSystem getFileSystem()
getFileSystem
in interface Path
public boolean isAbsolute()
isAbsolute
in interface Path
public Path getFileName()
getFileName
in interface Path
public int getNameCount()
getNameCount
in interface Path
public boolean startsWith(Path other)
startsWith
in interface Path
public boolean startsWith(String other)
startsWith
in interface Path
public Path resolveSibling(Path other)
resolveSibling
in interface Path
public Path resolveSibling(String other)
resolveSibling
in interface Path
public Path relativize(Path other)
relativize
in interface Path
public Path toAbsolutePath()
toAbsolutePath
in interface Path
public Path toRealPath(LinkOption... options) throws IOException
toRealPath
in interface Path
IOException
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException
register
in interface Path
register
in interface Watchable
IOException
public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) throws IOException
register
in interface Path
register
in interface Watchable
IOException
public int compareTo(Path other)
compareTo
in interface Comparable<Path>
compareTo
in interface Path
public int hashCode()