package test.vfs; import java.io.File; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.commons.vfs2.FileChangeEvent; import org.apache.commons.vfs2.FileListener; import org.apache.commons.vfs2.FileName; import org.apache.commons.vfs2.FileObject; import org.apache.commons.vfs2.FileSystemException; import org.apache.commons.vfs2.FileSystemManager; import org.apache.commons.vfs2.VFS; import org.apache.commons.vfs2.impl.DefaultFileMonitor; /** * Hello world! * */ public class App { public static final Log log = LogFactory.getLog(App.class); public static void main(String[] args) { FileSystemManager fsManager = null; FileObject listendir = null; try { fsManager = VFS.getManager(); listendir = fsManager.resolveFile(new File("E://vfs").getAbsolutePath()); } catch (FileSystemException e) { log.error("监视文件夹出错了", e); e.printStackTrace(); } System.out.println(listendir.getName()); // 定义一个监视器及事件处理程序 DefaultFileMonitor fm = new DefaultFileMonitor(new FileListener() { public void fileCreated(FileChangeEvent event) throws Exception { monitor(event); } public void fileDeleted(FileChangeEvent event) throws Exception { monitor(event); } public void fileChanged(FileChangeEvent event) throws Exception { monitor(event); } private void monitor(FileChangeEvent event) { FileObject fileObject = event.getFile(); FileName fileName = fileObject.getName(); System.out.println(fileName.toString()); } }); fm.setRecursive(true); // 设置为级联监控 fm.addFile(listendir); // 增加监控文件 fm.start(); // 启动监视器 for(;;){ try { Thread.currentThread().sleep(1000); System.out.println(System.currentTimeMillis()); } catch (InterruptedException e) { e.printStackTrace(); } } } }
相关推荐
Apache Commons VFS是一个虚拟文件系统库。 文献资料 可以在上找到更多信息。 可以浏览 。 与Apache Commons VFS Project的用法有关的问题应张贴到。 在哪里可以获得最新版本? 您可以从我们的下载源代码和二进制...
适用于VFS(Apache Commons虚拟文件系统)的Amazon S3驱动程序最新分支4.xx如何将依赖项添加到您的Maven构建中对于具有嵌入式AWS开发工具包的工件(引导的最简单方法) <dependency> <groupId>...对于没有依赖关系的...
apache commons all 中文api合集
适用于Apache Commons VFS的Dropbox插件
CMIS 的 Apache Commons VFS 提供程序实现 当前,此实现实际上是测试该想法的原型,但它已经能够: 使用 Atom Pub 绑定连接到 repo.opencmis.org 上的测试存储库 基于基本 URL 的身份验证 访问根文件夹 导航树结构...
离线安装包,亲测可用
commons-lang3.3.1.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。为JRE5.0+的更好的版本所提供 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE....
番石榴 该库提供了以为后端的实用程序方法。 在大多数方法中,签名已从... compile( group : ' net.simon04 ' , name : ' guava-vfs ' , version : ' 1.1.0 ' , ext : ' jar ' ) } 执照 麻省理工学院 作者 西蒙·莱格纳
apache Commons Lang 2.4 API apache Commons Lang 2.4 API
apache commons jar(commons所有的jar包,从官网下载提供给大家) 因为涉及jar太多,包括有src源代码,只需要3分,希望大家理解,我也是从官网花了很长时间才一个一个下完,需要的请自取。全部是zip文件,每个对应的...
commons-lang3.3.1.jar、Apache Commons包中的一个,包含了一些数据类型工具类,是java.lang.*的扩展。必须使用的jar包。为JRE5.0+的更好的版本所提供 Jar文件包含的类: META-INF/MANIFEST.MFMETA-INF/LICENSE....
Apache Commons是一个非常有用的工具包,解决各种实际的通用问题。(附件中提供了该工具包的jar包,及源文件以供研究) BeanUtils Commons-BeanUtils 提供对 Java 反射和自省API的包装 Betwixt Betwixt提供将 ...
Apache Commons Collections,commons-collections-3.2.1和commons-collections4-4.0,含jar包及源码和api文档。
apache 虚拟文件系统 vfs jar包~~~~
主要介绍了Apache Commons Math3探索之多项式曲线拟合实现代码,小编觉得挺不错的,这里分享给大家,供需要的朋友参考。
Apache Commons API简介,主要介绍Apache Commons API所包含的包,后续更新补充各类的简介和使用方法
apache commons 工具包中提供的一个针对配置文件动态修改的工具类
apache commons.fileupload上传组件在上传文件时,在调用parseRequest方法时,先将输入流上传到服务器临时目录,在之后的文件处理过程中,再将临时目录下保存的文件复制到指定的目录,多了一道转储步骤。本实现抽取...
Commons-beanutils-API Commons-collections-API Commons-configuration-API Commons-lang-API Commons-logging-API Dom4j_API java api javascript Struts API J2EE API
apache-commons下全部官方源码和官方API文档,其中有: commons-beanutils-1.8.0 commons-codec commons-collections commons-dbcp commons-dbutils commons-fileupload commons-io commons-lang commons-lang3 ...