private FileFilter getFileFilter(final String type){
return new FileFilter(){
@Override
public boolean accept(File pathname) {
boolean ret = false;
final String name = pathname.getName();
// File thisfile = new File(file.getPath() + "/" + name);
if (type.equals(Util.PDF_TYPE)) {
ret = name.toUpperCase().endsWith(Util.PDF_DATA_TYPE)
|| pathname.isDirectory();
} else if (type.equals(Util.DOC_TYPE)) {
ret = name.toUpperCase().endsWith(Util.WORD_DATA_TYPE)
|| pathname.isDirectory();
} else if (type.equals(Util.PIC_TYPE)) {
ret = name.toUpperCase().endsWith(
Util.PNG_PICTURE_DATA_TYPE)
|| name.toUpperCase().endsWith(
Util.JPG_PICTURE_DATA_TYPE)
|| name.toUpperCase().endsWith(
Util.BMP_PICTURE_DATA_TYPE)
|| pathname.isDirectory();
}
// boolean ret = name.endsWith(_extension) ||
// file.isDirectory();
return ret;
}
};
}
阅读(1243) | 评论(0) | 转发(0) |