public interface Watchable
该接口定义了一个WatchService
返回WatchKey
代表注册登记的对象register
方法。一个对象可以注册一个以上的表服务。一个手表服务注册是通过调用关键的cancel
方法取消。
Modifier and Type | Method and Description |
---|---|
WatchKey |
register(WatchService watcher, WatchEvent.Kind<?>... events)
用监视服务注册一个对象。
|
WatchKey |
register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers)
用监视服务注册一个对象。
|
WatchKey register(WatchService watcher, WatchEvent.Kind<?>[] events, WatchEvent.Modifier... modifiers) throws IOException
如果这个对象确定文件系统对象目前与观看服务然后看关键注册,代表注册,返回改变后的事件集或修饰那些指定的events
和modifiers
参数。更改事件集不会导致被丢弃的对象的挂起事件。对象是自动注册为OVERFLOW
事件。此事件不需要在事件数组中存在。
否则,文件系统对象尚未注册与给定的表服务,所以它是注册的,并返回所产生的新密钥。
此接口的实现应指定它们支持的事件。
watcher
-看服务的对象是注册
events
的事件,这个对象应该被注册
modifiers
-改性剂,如果有的话,修改对象如何注册
UnsupportedOperationException
-如果指定了不受支持的事件或改性剂
IllegalArgumentException
如果事件组合无效是修饰符指定
ClosedWatchServiceException
如果看服务关闭
IOException
如果I/O错误发生
SecurityException
如果安全管理器安装,它否认未指定许可需监测对象。此接口的实现应指定权限检查。
WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) throws IOException
此方法的调用与调用的方式完全相同的行为
有看头。register
(人,事件,新的watchevent。改性剂[ 0 ]);
watcher
-看服务的对象是注册
events
的事件,这个对象应该被注册
UnsupportedOperationException
-如果指定了不受支持的事件
IllegalArgumentException
-如果指定事件的组合无效
ClosedWatchServiceException
如果看服务关闭
IOException
如果I/O错误发生
SecurityException
如果安全管理器安装,它否认未指定许可需监测对象。此接口的实现应指定权限检查。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.