Reactive Wrapper for Java8 WatchService
Sep 12, 2018Updated to Rx2, fix some bugs.
Jul 18, 2015Initial project, first release by Helmbold.
The following example creates an observable that watches the given directory and all its subdirectories for file system events. Directories which are created later are watched, too. Each event will be emitted as a WatchEvent.
PathObservables .watchRecursive(Paths.get("some/directory/")) .subscribe(event -> System.out.println(event));
To watch only the top-level directory, you call
watchNonRecursive instead of
PathObservables .watchNonRecursive(Paths.get("some/directory/")) .subscribe(event -> System.out.println(event));
See RxJava Documentation for more information, e. g. how you can filter certain types of events.
Available on Maven Central.
<dependency> <groupId>de.helmbold</groupId> <artifactId>rxfilewatcher</artifactId> <version>1.0.0</version> </dependency>