快捷搜索:

采用多线程自动监视并扫描指定文件夹中的文件

采纳多线程自动监视并扫描指定文件夹中的文件变更,实现其功能的代码由四个java文件组成 :FileListener.java,FileMonitor.java,FileTableModel.java,ParseUtility.java。其详细代码如下:

FileListener.java

/*

* FileListener.java

*

* Created on 2007-9-27, 17:58:49

*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package DirectoryScanner;

/**

*

* @author Hale Chou

*/

public interface FileListener {

void dirChanged(FileMonitor monitor);

}

FileMonitor.java

/*

* FileMonitor.java

*

* Created on 2007-9-27, 17:59:05

*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package DirectoryScanner;

import java.io.File;

import java.util.ArrayList;

import java.util.List;

/**

*

* @author Hale Chou

*/

public class FileMonitor implements Runnable {

List<FileListener

您可能还会对下面的文章感兴趣: