类
public class DirectoryTracker extends DirectoryWalker<String> {
private int bufferSize=100;
private final List<String> workedBuffer=Collections.synchronizedList(new ArrayList<String>());
private static final Logger log = LoggerFactory.getLogger(DirectoryTracker.class);
public DirectoryTracker(FileFilter filter) {
super(filter,-1);
// TODO Auto-generated constructor stub
}
/**
* 设置一次处理的结果集大小
* @param size
*/
public void setBufferSize(int size){
this.bufferSize=size;
}
@Override
protected boolean handleDirectory(File directory, int depth, Collection<String> results) throws IOException {
// TODO Auto-generated method stub
//这理怎么写
return true;
}
@Override
protected void handleFile(File file, int depth, Collection<String> results) throws IOException {
// TODO Auto-generated method stub
//super.handleFile(file, depth, results);
results.add(file.getAbsolutePath());
}
private List<String> getAllFile(File startDirectory) throws IOException{
List<String> result=new ArrayList<>(bufferSize);
walk(startDirectory,result);
return result;
}
//ETC
}
指定一个开始的目录(例:D:\Documents\Pictures),这个目录下有图片也有子目录,子目录的情况如父目录一样,现在这个类不进入子目录,怎样作到无限递归遍历