Apache VFS(2):文件的监听和监控

来源:互联网 发布:大话设计模式java pdf 编辑:程序博客网 时间:2024/06/16 01:50

本系列文章导航

Apache VFS(1): 基本介绍

Apache VFS(2): 文件的监听和监控

Apache VFS(3): 文件过滤器和选择器

Apache VFS(4): 事件

Apache VFS(5): 使用它!

Apache VFS(6): 几个重要的概念性接口

Apache VFS(7): 文件管理器解析文件的方法

 Apache VFS有文件监听和监控功能。

FileListener接口监听三种事件:

  • fileChanged(FileChangeEvent eve): 文件变化,只有使用了FileMonitor才触发
  • fileCreated(FileChangeEvent eve): 文件创建
  • fileDeleted(FileChangeEvent eve): 文件删除

FileChangeEvent很简单,只有一个方法getFile(),返回触发事件的FileObject对象。

 

文章来源:http://alartin.javaeye.com/blog/92084