| Modifier and Type | Field and Description |
|---|---|
| private final FileSystem | |
| private final String |
| Modifier and Type | Method and Description |
|---|---|
| public int | compareTo(Path
the path compared to this path. other)Implements java. Compares two abstract paths lexicographically. |
| public boolean | endsWith(Path
the given path other)Implements java. Tests if this path ends with the given path. |
| public boolean | endsWith(String
the given path string other)Overrides default java. Tests if this path ends with a |
| public Path | getFileName()
Implements java. Returns the name of the file or directory denoted by this path as a
|
| public FileSystem | getFileSystem()
Implements java. Returns the file system that created this object. |
| public Path | getName(int
the index of the element index)Implements java. Returns a name element of this path as a |
| public int | getNameCount()
Implements java. Returns the number of name elements in the path. |
| public Path | getParent()
Implements java. Returns the parent path, or |
| public Path | getRoot()
Implements java. Returns the root component of this path as a |
| public boolean | |
| public Iterator | iterator()
Overrides default java. Returns an iterator over the name elements of this path. |
| public Path | normalize()
Implements java. Returns a path that is this path with redundant name elements eliminated. |
| public WatchKey | register(WatchService
The watch service to which this object is to be registered watcher, WatchEvent.The events for which this object should be registered eventsOverrides default java. Registers the file located by this path with a watch service. |
| public WatchKey | register(WatchService
the watch service to which this object is to be registered watcher, WatchEvent.the events for which this object should be registered events,the modifiers, if any, that modify how the object is registered modifiersImplements java. Registers the file located by this path with a watch service. |
| public Path | relativize(Path
the path to relativize against this path other)Implements java. Constructs a relative path between this path and a given path. |
| public Path | resolve(Path
the path to resolve against this path other)Implements java. Resolve the given path against this path. |
| public Path | resolve(String
the path string to resolve against this path other)Overrides default java. Converts a given path string to a |
| public Path | resolveSibling(Path
the path to resolve against this path's parent other)Overrides default java. Resolves the given path against this path's |
| public Path | resolveSibling(String
the path string to resolve against this path's parent other)Overrides default java. Converts a given path string to a |
| public boolean | startsWith(Path
the given path other)Implements java. Tests if this path starts with the given path. |
| public boolean | startsWith(String
the given path string other)Overrides default java. Tests if this path starts with a |
| public Path | subpath(int
the index of the first element, inclusive beginIndex, int the index of the last element, exclusive endIndex)Implements java. Returns a relative |
| public Path | toAbsolutePath()
Implements java. Returns a |
| public File | |
| public Path | toRealPath(LinkOption...
options indicating how symbolic links are handled options)Implements java. Returns the real path of an existing file. |
| public String | toString()
Overrides java. Implements java. Returns the string representation of this path. |
| public URI |
| fs | back to summary |
|---|---|
| private final FileSystem fs | |
| path | back to summary |
|---|---|
| private final String path | |
| MockPath | back to summary |
|---|---|
| public MockPath(String path) | |
| compareTo | back to summary |
|---|---|
| public int compareTo(Path other) Implements java. Doc from java. Compares two abstract paths lexicographically. The ordering defined by this method is provider specific, and in the case of the default provider, platform specific. This method does not access the file system and neither file is required to exist. This method may not be used to compare paths that are associated with different file system providers. | |
| endsWith | back to summary |
|---|---|
| public boolean endsWith(Path other) Implements java. Doc from java. Tests if this path ends with the given path. If the given path has N elements, and no root component, and this path has N or more elements, then this path ends with the given path if the last N elements of each path, starting at the element farthest from the root, are equal. If the given path has a root component then this path ends with the given path if the root component of this path ends with the root component of the given path, and the corresponding elements of both paths are equal. Whether or not the root component of this path ends with the root component of the given path is file system specific. If this path does not have a root component and the given path has a root component then this path does not end with the given path. If the given path is associated with a different | |
| endsWith | back to summary |
|---|---|
| public boolean endsWith(String other) Overrides default java. Doc from java. Tests if this path ends with a | |
| getFileName | back to summary |
|---|---|
| public Path getFileName() Implements java. Doc from java. Returns the name of the file or directory denoted by this path as a
| |
| getFileSystem | back to summary |
|---|---|
| public FileSystem getFileSystem() Implements java. Doc from java. Returns the file system that created this object.
| |
| getName | back to summary |
|---|---|
| public Path getName(int index) Implements java. Doc from java. Returns a name element of this path as a The | |
| getNameCount | back to summary |
|---|---|
| public int getNameCount() Implements java. Doc from java. Returns the number of name elements in the path.
| |
| getParent | back to summary |
|---|---|
| public Path getParent() Implements java. Doc from java. Returns the parent path, or The parent of this path object consists of this path's root
component, if any, and each element in the path except for the
farthest from the root in the directory hierarchy. This method
does not access the file system; the path or its parent may not exist.
Furthermore, this method does not eliminate special names such as "."
and ".." that may be used in some implementations. On UNIX for example,
the parent of " If this path has more than one element, and no root component, then this method is equivalent to evaluating the expression: subpath(0, getNameCount()-1); | |
| getRoot | back to summary |
|---|---|
| public Path getRoot() Implements java. Doc from java. Returns the root component of this path as a | |
| isAbsolute | back to summary |
|---|---|
| public boolean isAbsolute() Implements java. Doc from java. Tells whether or not this path is absolute. An absolute path is complete in that it doesn't need to be combined with other path information in order to locate a file.
| |
| iterator | back to summary |
|---|---|
| public Iterator Overrides default java. Doc from java. Returns an iterator over the name elements of this path. The first element returned by the iterator represents the name
element that is closest to the root in the directory hierarchy, the
second element is the next closest, and so on. The last element returned
is the name of the file or directory denoted by this path. The | |
| normalize | back to summary |
|---|---|
| public Path normalize() Implements java. Doc from java. Returns a path that is this path with redundant name elements eliminated. The precise definition of this method is implementation dependent but
in general it derives from this path, a path that does not contain
redundant name elements. In many file systems, the " This method does not access the file system; the path may not locate
a file that exists. Eliminating " | |
| register | back to summary |
|---|---|
| public WatchKey register(WatchService watcher, WatchEvent. Overrides default java. Doc from java. Registers the file located by this path with a watch service. An invocation of this method behaves in exactly the same way as the invocation register(watcher, events, new WatchEvent.Modifier[0]); Usage Example: Suppose we wish to register a directory for entry create, delete, and modify events: Path dir = ... WatchService watcher = ... WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
| |
| register | back to summary |
|---|---|
| public WatchKey register(WatchService watcher, WatchEvent. Implements java. Doc from java. Registers the file located by this path with a watch service. In this release, this path locates a directory that exists. The
directory is registered with the watch service so that entries in the
directory can be watched. The
The The set of events may include additional implementation specific
event that are not defined by the enum The Where a file is registered with a watch service by means of a symbolic link then it is implementation specific if the watch continues to depend on the existence of the symbolic link after it is registered.
| |
| relativize | back to summary |
|---|---|
| public Path relativize(Path other) Implements java. Doc from java. Constructs a relative path between this path and a given path. Relativization is the inverse of For any two p When symbolic links are supported, then whether the resulting path,
when resolved against this path, yields a path that can be used to locate
the | |
| resolve | back to summary |
|---|---|
| public Path resolve(Path other) Implements java. Doc from java. Resolve the given path against this path. If the | |
| resolve | back to summary |
|---|---|
| public Path resolve(String other) Overrides default java. Doc from java. Converts a given path string to a | |
| resolveSibling | back to summary |
|---|---|
| public Path resolveSibling(Path other) Overrides default java. Doc from java. Resolves the given path against this path's | |
| resolveSibling | back to summary |
|---|---|
| public Path resolveSibling(String other) Overrides default java. Doc from java. Converts a given path string to a | |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(Path other) Implements java. Doc from java. Tests if this path starts with the given path. This path starts with the given path if this path's root
component starts with the root component of the given path,
and this path starts with the same name elements as the given path.
If the given path has more name elements than this path then Whether or not the root component of this path starts with the root component of the given path is file system specific. If this path does not have a root component and the given path has a root component then this path does not start with the given path. If the given path is associated with a different | |
| startsWith | back to summary |
|---|---|
| public boolean startsWith(String other) Overrides default java. Doc from java. Tests if this path starts with a | |
| subpath | back to summary |
|---|---|
| public Path subpath(int beginIndex, int endIndex) Implements java. Doc from java. Returns a relative The | |
| toAbsolutePath | back to summary |
|---|---|
| public Path toAbsolutePath() Implements java. Doc from java. Returns a If this path is already | |
| toFile | back to summary |
|---|---|
| public File toFile() Overrides default java. Doc from java. Returns a If this path was created by invoking the | |
| toRealPath | back to summary |
|---|---|
| public Path toRealPath(LinkOption... options) throws IOException Implements java. Doc from java. Returns the real path of an existing file. The precise definition of this method is implementation dependent but
in general it derives from this path, an If this path is relative then its absolute path is first obtained,
as if by invoking the The
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements java. Doc from java. Returns the string representation of this path. If this path was created by converting a path string using the
The returned path string uses the default name | |
| toUri | back to summary |
|---|---|
| public URI toUri() Implements java. Doc from java. Returns a URI to represent this path. This method constructs an absolute In the case of the default provider, the URI is hierarchical with
a The default provider provides a similar round-trip guarantee
to the so long as the original Path, the URI, and the new Path are all created in (possibly different invocations of) the same
Java virtual machine. Whether other providers make any guarantees is
provider specific and therefore unspecified.
When a file system is constructed to access the contents of a file as a file system then it is highly implementation specific if the returned URI represents the given path in the file system or it represents a compound URI that encodes the URI of the enclosing file system. A format for compound URIs is not defined in this release; such a scheme may be added in a future release. | |