![]() ![]() Create a test directory that will be passed to the example. WatchDir example to your computer, and compile it. You can dedicate aīecause this API is more advanced, try it out before proceeding. WatchKeys are thread-safe and can be used with the package. Close the service: The watch service exits when either the thread exits or when it is closed (by invoking its closed method).Reset the key, and resume waiting for events.Retrieve each pending event for the key (there might be multiple events) and process as needed.You can obtain the file name from the key. Retrieve the key from the watcher's queue.When an event occurs, the key is signaled and placed into the watcher's queue. Implement an infinite loop to wait for incoming events. ![]() You receive a WatchKey instance for each directory that you register. ![]() When registering a directory, you specify the type of events for which you want notification.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |