Page 1 of 1
About Question enthuware.ocpjp.v7.2.1519 :
Posted: Sun Jul 12, 2015 1:09 pm
by fariz.siracli
where can i read about WatchService and possible counts of events?
Re: About Question enthuware.ocpjp.v7.2.1519 :
Posted: Sun Jul 12, 2015 1:11 pm
by admin
Re: About Question enthuware.ocpjp.v7.2.1519 :
Posted: Sun Jul 12, 2015 1:12 pm
by admin
Re: About Question enthuware.ocpjp.v7.2.1519 :
Posted: Sun Mar 20, 2016 5:53 am
by sumanenthu
What do you exactly try to mean by "The counts for ENTRY_CREATE and ENTRY_DELETE are exactly 1"? Does it mean that at a time we can have only one entry_create event queued?
Re: About Question enthuware.ocpjp.v7.2.1519 :
Posted: Sun Mar 20, 2016 9:42 pm
by admin
When you get a WatchEvent object, you can call its count() method to find out the number of times that event has occurred. However, if the event is for creation or deletion of a directory, then this method always returns 1.
Try playing with some sample code to understand this better:
http://www.codejava.net/java-se/file-io ... ervice-api
Re: About Question enthuware.ocpjp.v7.2.1519 :
Posted: Tue Aug 09, 2016 11:49 am
by insider
In explanation:
WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events) throws IOException
Second argument is actually a vararg, should be "WatchEvent.Kind<?>... events".
https://docs.oracle.com/javase/7/docs/a ... hable.html