private void internal_watchDirectoryPath() throws IOException {
  WatchKey key=null;
  boolean stopPolling=false;
  for (; ; ) {
    try {
      key=watchService.take();
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    List<WatchEvent<?>> keys=key.pollEvents();
    for (    WatchEvent<?> watchEvent : keys) {
      Kind<?> watchEventKind=watchEvent.kind();
      if (watchEventKind == StandardWatchEventKinds.OVERFLOW) {
        continue;
      }
      Path dir=(Path)key.watchable();
      Path fullPath=dir.resolve((Path)watchEvent.context());
      FileWatcherUpdateInterface parentObj=watcherMap.get(key);
      if (watchEventKind == StandardWatchEventKinds.ENTRY_CREATE) {
        if (parentObj != null) {
          parentObj.fileAdded(fullPath);
        }
      }
 else       if (watchEventKind == StandardWatchEventKinds.ENTRY_MODIFY) {
        if (parentObj != null) {
          parentObj.fileModified(fullPath);
        }
      }
 else       if (watchEventKind == StandardWatchEventKinds.ENTRY_DELETE) {
        if (parentObj != null) {
          parentObj.fileDeleted(fullPath);
        }
      }
      key.reset();
    }
    if (stopPolling) {
      break;
    }
  }
  watchService.close();
}

private void internal_watchDirectoryPath ( ) throws IOException { WatchKey key = null ; boolean stopPolling = false ; for ( ; ; ) { try { key = watchService . take ( ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } List < WatchEvent < ? > > keys = key . pollEvents ( ) ; for ( WatchEvent < ? > watchEvent : keys ) { Kind < ? > watchEventKind = watchEvent . kind ( ) ; if ( watchEventKind == StandardWatchEventKinds . OVERFLOW ) { continue ; } Path dir = ( Path ) key . watchable ( ) ; Path fullPath = dir . resolve ( ( Path ) watchEvent . context ( ) ) ; FileWatcherUpdateInterface parentObj = watcherMap . get ( key ) ; if ( watchEventKind == StandardWatchEventKinds . ENTRY_CREATE ) { if ( parentObj != null ) { parentObj . fileAdded ( fullPath ) ; } } else if ( watchEventKind == StandardWatchEventKinds . ENTRY_MODIFY ) { if ( parentObj != null ) { parentObj . fileModified ( fullPath ) ; } } else if ( watchEventKind == StandardWatchEventKinds . ENTRY_DELETE ) { if ( parentObj != null ) { parentObj . fileDeleted ( fullPath ) ; } } key . reset ( ) ; } if ( stopPolling ) { break ; } } watchService . close ( ) ; }
internal watch directory path method .
