public void onEvent ( final WatchEvent < Path > event ) { Kind kind = event . kind ( ) ; if ( StandardWatchEventKind . ENTRY_CREATE . equals ( kind ) ) { File file = new File ( event . context ( ) . toString ( ) ) ; listener . fileCreated ( file ) ; } else if ( StandardWatchEventKind . ENTRY_DELETE . equals ( kind ) ) { File file = new File ( event . context ( ) . toString ( ) ) ; listener . fileDeleted ( file ) ; } else if ( StandardWatchEventKind . ENTRY_MODIFY . equals ( kind ) ) { File file = new File ( event . context ( ) . toString ( ) ) ; listener . fileChanged ( file ) ; } }
Forwards watch events to the listener .