本文整理汇总了Java中org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FileFilterUtils.fileFileFilter方法的具体用法?Java FileFilterUtils.fileFileFilter怎么用?Java FileFilterUtils.fileFileFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.filefilter.FileFilterUtils
的用法示例。
在下文中一共展示了FileFilterUtils.fileFileFilter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fileFilter
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter fileFilter() {
IOFileFilter fileFileFilter = FileFilterUtils.fileFileFilter();
IOFileFilter[] noes = new IOFileFilter[]{
new RegexFileFilter(B + X + D + "class" + E),
new RegexFileFilter(B + X + D + "db" + E),
new RegexFileFilter(B + X + D + "ear" + E),
new RegexFileFilter(B + X + D + "err" + E),
new RegexFileFilter(B + X + D + "gif" + E),
new RegexFileFilter(B + X + D + "jar" + E),
new RegexFileFilter(B + X + D + "jpg" + E),
new RegexFileFilter(B + X + D + "lnk" + E),
new RegexFileFilter(B + X + D + "log" + E),
new RegexFileFilter(B + X + D + "nbm" + E),
new RegexFileFilter(B + X + D + "out" + E),
new RegexFileFilter(B + X + D + "png" + E),
new RegexFileFilter(B + X + D + "war" + E),
new RegexFileFilter(B + X + D + "zip" + E)
};
IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
IOFileFilter filter = FileFilterUtils.and(fileFileFilter, noesFileFilter);
return filter;
}
示例2: listFiles
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Recurse in the folder to get the list all files and folders
* <ul>
* <li>do not recurse in svn folder</li>
* <li>do not recurse in cvs folder</li>
* <li>do not match .bak files</li>
* <li>do not match .old files</li>
* </ul>
*
* @param folder the folder to parse
* @param ioFileFilter additionnal IOFilter
*/
@SuppressWarnings("unchecked")
public Collection<String> listFiles(File folder, IOFileFilter ioFileFilter) {
if (ioFileFilter == null) {
ioFileFilter = FileFilterUtils.fileFileFilter();
}
OrFileFilter oldFilesFilter = new OrFileFilter();
for (String exclude : DEFAULT_EXCLUDES_SUFFIXES) {
oldFilesFilter.addFileFilter(FileFilterUtils.suffixFileFilter(exclude));
}
IOFileFilter notOldFilesFilter = FileFilterUtils.notFileFilter(oldFilesFilter);
Collection<File> files = FileUtils.listFiles(folder, FileFilterUtils.andFileFilter(ioFileFilter, notOldFilesFilter),
FileFilterUtils.makeSVNAware(FileFilterUtils.makeCVSAware(null)));
Collection<String> ret = newArrayList();
for (File file : files) {
ret.add(file.getAbsolutePath());
}
return ret;
}
示例3: getSearchResults
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
@Override
public List<? extends BusinessObject> getSearchResults(Map<String, String> fieldValues) {
List<BatchFile> results = new ArrayList<BatchFile>();
IOFileFilter filter = FileFilterUtils.fileFileFilter();
IOFileFilter pathBasedFilter = getPathBasedFileFilter();
if (pathBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, pathBasedFilter);
}
String fileNamePattern = fieldValues.get("fileName");
IOFileFilter fileNameBasedFilter = getFileNameBasedFilter(fileNamePattern);
if (fileNameBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, fileNameBasedFilter);
}
String lastModifiedDate = fieldValues.get("lastModifiedDate");
IOFileFilter lastModifiedDateBasedFilter = getLastModifiedDateBasedFilter(lastModifiedDate);
if (lastModifiedDateBasedFilter != null) {
filter = FileFilterUtils.andFileFilter(filter, lastModifiedDateBasedFilter);
}
BatchFileFinder finder = new BatchFileFinder(results, filter);
List<File> rootDirectories = BatchFileUtils.retrieveBatchFileLookupRootDirectories();
finder.find(rootDirectories);
return results;
}
示例4: defaultFileFilter
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected IOFileFilter defaultFileFilter() {
// This was the default, being removed to widen the scope,
// since extension-based dispatch is implemented at the Build level
// anyway, to call the right Rhino-based compilers.
// return FileUtil.fileFilterForExtensions(this.getAssetExtensions());
return FileFilterUtils.fileFileFilter();
}
示例5: countFiles
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private Integer countFiles(File path){
int total = 0;
FileFilter filesOnly = FileFilterUtils.fileFileFilter();
FileFilter dirsOnly = FileFilterUtils.directoryFileFilter();
File[] files = path.listFiles(filesOnly);
System.out.println(files);
total += files.length;
for (File file : path.listFiles(dirsOnly)){
total += countFiles(file);
}
return total;
}