Package org.hcjf.io.fs
Class FileSystemWatcherConsumer
- java.lang.Object
-
- org.hcjf.io.fs.FileSystemWatcherConsumer
-
- All Implemented Interfaces:
ServiceConsumer
public abstract class FileSystemWatcherConsumer extends java.lang.Object implements ServiceConsumer
This class must be implemented if tou want to consume the file system watcher service.- Author:
- javaito
-
-
Constructor Summary
Constructors Constructor Description FileSystemWatcherConsumer(java.nio.file.Path path, java.nio.file.WatchEvent.Kind... eventKinds)Constructor
-
Method Summary
Modifier and Type Method Description protected voidcreate(java.nio.file.WatchEvent<java.nio.file.Path> event)This method must be implemented if you want to listen the create event over the base path.protected voiddelete(java.nio.file.WatchEvent<java.nio.file.Path> event)This method must be implemented if you want to listen the delete event over the base path.java.nio.file.PathgetBasePath()Return the base path.java.nio.file.WatchEvent.Kind[]getEventKinds()Return an array of the event kinds.java.lang.StringgetFileName()Return the file name associated to the consumer or null if the consumer is watching a directoryjava.nio.file.PathgetPath()Return complete path.protected voidoverflow(java.nio.file.WatchEvent<java.nio.file.Path> event)This method must be implemented if you want to listen the overflow event over the base path.protected voidupdate(java.nio.file.WatchEvent<java.nio.file.Path> event)This method must be implemented if you want to listen the update event over the base path.
-
-
-
Constructor Detail
-
FileSystemWatcherConsumer
public FileSystemWatcherConsumer(java.nio.file.Path path, java.nio.file.WatchEvent.Kind... eventKinds)Constructor- Parameters:
path- Base path, all the paths bellow of the base are wached by the consumereventKinds- Kinds of events that this consumer are listening
-
-
Method Detail
-
getPath
public java.nio.file.Path getPath()
Return complete path. If the consumer is watching a directory then path and base path are the same.- Returns:
- Complete path.
-
getBasePath
public final java.nio.file.Path getBasePath()
Return the base path.- Returns:
- Base path.
-
getFileName
public final java.lang.String getFileName()
Return the file name associated to the consumer or null if the consumer is watching a directory- Returns:
- File name or null.
-
getEventKinds
public final java.nio.file.WatchEvent.Kind[] getEventKinds()
Return an array of the event kinds.- Returns:
- Event kinds.
-
create
protected void create(java.nio.file.WatchEvent<java.nio.file.Path> event)
This method must be implemented if you want to listen the create event over the base path.- Parameters:
event- Event information.
-
update
protected void update(java.nio.file.WatchEvent<java.nio.file.Path> event)
This method must be implemented if you want to listen the update event over the base path.- Parameters:
event- Event information.
-
delete
protected void delete(java.nio.file.WatchEvent<java.nio.file.Path> event)
This method must be implemented if you want to listen the delete event over the base path.- Parameters:
event- Event information.
-
overflow
protected void overflow(java.nio.file.WatchEvent<java.nio.file.Path> event)
This method must be implemented if you want to listen the overflow event over the base path.- Parameters:
event- Event information.
-
-