public class PathWatchers
extends java.lang.Object
PathWatcher. It also
defines the PathWatchers.Event class for which the PathWatcher will emit events.| Modifier and Type | Class and Description |
|---|---|
static class |
PathWatchers.Event
Container for
PathWatcher events. |
| Modifier and Type | Method and Description |
|---|---|
static PathWatcher<PathWatchers.Event> |
get(boolean followLinks)
Create a PathWatcher for the runtime platform.
|
static PathWatcher<PathWatchers.Event> |
polling(boolean followLinks,
long pollInterval,
java.util.concurrent.TimeUnit timeUnit)
Create a path watcher that periodically polls the file system to detect changes
|
static PathWatcher<PathWatchers.Event> |
polling(FileTreeDataViews.Converter<java.lang.Long> converter,
boolean followLinks,
long pollInterval,
java.util.concurrent.TimeUnit timeUnit)
Create a path watcher that periodically polls the file system to detect changes
|
public static PathWatcher<PathWatchers.Event> get(boolean followLinks) throws java.io.IOException, java.lang.InterruptedException
followLinks - toggles whether or not the targets of symbolic links should be monitoredjava.io.IOException - when the underlying WatchService cannot be
initializedjava.lang.InterruptedException - when the PathWatcher is interrupted during initializationpublic static PathWatcher<PathWatchers.Event> polling(FileTreeDataViews.Converter<java.lang.Long> converter, boolean followLinks, long pollInterval, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
converter - calculates the last modified time in milliseconds for the path watcher. This
exists so that the converter can be replaced with a higher resolution calculation of the
file system last modified time than is provided by the jvm, e.g.
sbt.IO.getLastModifiedTimeOrZero.followLinks - toggles whether or not the targets of symbolic links should be monitoredpollInterval - minimum duration between when polling ends and the next poll beginstimeUnit - the time unit for which the pollInterval correspondsjava.lang.InterruptedException - if the polling thread cannot be started.public static PathWatcher<PathWatchers.Event> polling(boolean followLinks, long pollInterval, java.util.concurrent.TimeUnit timeUnit) throws java.lang.InterruptedException
followLinks - toggles whether or not the targets of symbolic links should be monitoredpollInterval - minimum duration between when polling ends and the next poll beginstimeUnit - the time unit for which the pollInterval correspondsjava.lang.InterruptedException - if the polling thread cannot be started.