code: public final static Observable<WatchEvent<?>> from(final File file,
              final Action0 onWatchStarted, Kind<?>... kinds) {
          return watchService(file, kinds)
                  // when watch service created call onWatchStarted
                  .doOnNext(new Action1<WatchService>() {
                      @Override
                      public void call(WatchService w) {
                          if (onWatchStarted != null)
                              onWatchStarted.call();
                      }
                  })
                  // emit events from the WatchService
                  .flatMap(TO_WATCH_EVENTS)
                  // restrict to events related to the file
                  .filter(onlyRelatedTo(file));
      }
docs: If file does not exist at subscribe time then is assumed to not be a
  directory. If the file is not a directory (bearing in mind the aforesaid
  assumption) then a {@link WatchService} is set up on its parent and
  {@link WatchEvent}s of the given kinds are filtered to concern the file
  in question. If the file is a directory then a {@link WatchService} is
  set up on the directory and all events are passed through of the given
  kinds.
  
  @param file
  file to generate watch events from
  @param onWatchStarted
  called when WatchService is created
  @param kinds
  kinds of watch events to register for
  @return observable of watch events