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 root component, if present, is not returned by the iterator.
@implSpec
The default implementation returns an Iterator<Path> which, for
this path, traverses the Paths returned by
getName(index), where index ranges from zero to
getNameCount() - 1, inclusive.
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
watchable.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);
@implSpec The default implementation is equivalent for this path to:
register(watcher, events, new WatchEvent.Modifier[0]);
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 events parameter is the events to
register and may contain the following events:
ENTRY_CREATE -
entry created or moved into the directoryENTRY_DELETE -
entry deleted or moved out of the directoryENTRY_MODIFY -
entry in directory was modified The context for these events is the
relative path between the directory located by this path, and the path
that locates the directory entry that is created, deleted, or modified.
The set of events may include additional implementation specific
event that are not defined by the enum StandardWatchEventKinds
The modifiers parameter specifies modifiers that
qualify how the directory is registered. This release does not define any
standard modifiers. It may contain implementation specific
modifiers.
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.
Diagram: Path