Closed drapostolos closed 1 year ago
Added a default persisting mechanism, that can persist the state of each PolledDirectory to file, which can later be used by another instance of the DirectoryPoller.
PolledDirectory
DirectoryPoller
Usage Example:
Path storage = Paths.get("folder", "file.dat"); DirectoryPoller.newBuilder() .addPolledDirectory(new JavaIoFileAdapter(new File("C:\\temp\\polled1"))) .enableDefaultStatePersisting(storage, dir -> ((JavaIoFileAdapter)dir).getFile().toString(), str -> new JavaIoFileAdapter(new File(str))) .addListener(new AbstractRdp4jListener() { @Override public void fileAdded(FileAddedEvent event) throws InterruptedException { System.out.println("+" + event.getFileElement()); } @Override public void fileRemoved(FileRemovedEvent event) throws InterruptedException { System.out.println("-" + event.getFileElement()); } @Override public void fileModified(FileModifiedEvent event) throws InterruptedException { System.out.println("@" + event.getFileElement()); } }) .start() .awaitTermination();
Extends the change in PR #26
This has been released in version 0.3.0
Added a default persisting mechanism, that can persist the state of each
PolledDirectory
to file, which can later be used by another instance of theDirectoryPoller
.Usage Example: