for(WatchEvent<?> event:kC.pollEvents()){
switch(event.kind().name()){
case "OVERFLOW":
System.out.println("We lost some events");
break;
case "ENTRY_CREATE":
System.out.println("File " + event.context() + " has been modified!");
break;
case "ENTRY_MODIFY":
System.out.println("File" + event.context()+ "has been modified!");
case "ENTRY_DELETE":
System.out.println("File" + event.context()+ "has been deleted!");
I have 2 questions:
1) What should happen to a directory to actually queue the events? how many file should be deleted together to make the method queue and return a real list instead of a single element?
2) How can we trigger the "ENTRY_MODIFY" case? I tried personally to modify the file name of a directory on my desktop and it gave me back a "previous file has been deleted" plus "renamed file has been created". What do they mean with ENTRY_MODIFY?I also tried to modified the file content and nothing.It still triggers first ENTRY_DELETE and then ENTRY_CREATE. How is it possible to trigger ENTRY_MODIFY?
Ehy OCJP7 takers Has anybody come across (while walkingFileTreeing) to the ENTRY_MODIFY getting trigged. If so, could you please provide me with an example? Thanks in advance.
By using ubuntu and jdk 7 though when creating a new file in a watched folder I got a "ENTRY_CREATE" instead of an "ENTRY_MODIFY". Even though it should get an ENTRY_MODIFY why it does get an ENTRY_MODIFY instead of an ENTRY_CREATE if you had created something in that folder? What's the difference between ENTRY_MODIFY and ENTRY_CREATE? (I know that the name should say it all but it's quite confusing).