Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

README.md

Reactive Wrapper for Java8 WatchService

RxFileWatcher allows you to observe directories (recursively or not) for file system events with a RxJava observable. It is based on the JDK WatchService, but it is much more convenient.

What's New?

  1. Sep 12, 2018 Updated to Rx2, fix some bugs.
  2. Jul 18, 2015 Initial project, first release by Helmbold.

Usage

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 watchRecursive:

PathObservables
  .watchNonRecursive(Paths.get("some/directory/"))
  .subscribe(event -> System.out.println(event));

That's it!

See RxJava Documentation for more information, e. g. how you can filter certain types of events.

Get it

Available on Maven Central.

Maven

<dependency>
  <groupId>de.helmbold</groupId>
  <artifactId>rxfilewatcher</artifactId>
  <version>1.0.0</version>
</dependency>

Gradle

implementation('de.helmbold:rxfilewatcher:1.0.0')

About

Convenient file watcher with an RxJava interface, based on JDK WatchService

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.