Capture events happening inside a directory
问题 Im watching a directory using Java 7 nio WatchService by using below method. Path myDir = Paths.get("/rootDir"); try { WatchService watcher = myDir.getFileSystem().newWatchService(); myDir.register(watcher, StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_DELETE, StandardWatchEventKinds.ENTRY_MODIFY); WatchKey watckKey = watcher.take(); List<WatchEvent<?>> events = watckKey.pollEvents(); for (WatchEvent event : events) { if (event.kind() == StandardWatchEventKinds.ENTRY