/** * Declare a stream containing the absolute pathname of * newly created file names from watching {@code directory}. * <p> * This is the same as {@code directoryWatcher(t, () -> dir, null)}. * * @param te topology element whose topology the watcher will be added to * @param directory * Name of the directory to watch. * @return Stream containing absolute pathnames of newly created files in * {@code directory}. */ public static TStream<String> directoryWatcher(TopologyElement te, Supplier<String> directory) { return directoryWatcher(te, directory, null); }
TStream<String> fileNames = FileStreams.directoryWatcher(t, () -> dir.toAbsolutePath().toString());
TStream<String> pathnames = FileStreams.directoryWatcher(t, () -> dir.toAbsolutePath().toString()) .peek(tuple -> System.out.println(new Date() + " watcher added "+tuple))