public abstract WatchKey register (WatchService watcher, Kind<?>… events) throws IOException

Registers an object with a watch service.

An invocation of this method behaves in exactly the same way as the invocation

     watchable.register(watcher, events, new WatchEvent.Modifier[0]);
 

Parameters:
watcher     the watch service to which this object is to be registered
events     the events for which this object should be registered

Returns:  a key representing the registration of this object with the given watch service

Exceptions:
UnsupportedOperationException     if unsupported events are specified
IllegalArgumentException     if an invalid of combination of events are specified
ClosedWatchServiceException     if the watch service is closed
IOException     if an I/O error occurs
SecurityException     if a security manager is installed and it denies an unspecified permission required to monitor this object. Implementations of this interface should specify the permission checks.