本文整理汇总了Java中org.apache.commons.io.filefilter.FileFilterUtils.notFileFilter方法的典型用法代码示例。如果您正苦于以下问题:Java FileFilterUtils.notFileFilter方法的具体用法?Java FileFilterUtils.notFileFilter怎么用?Java FileFilterUtils.notFileFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.io.filefilter.FileFilterUtils
的用法示例。
在下文中一共展示了FileFilterUtils.notFileFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findGitRepos
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public static List<String> findGitRepos(String dirPath) {
File dir = new File(dirPath);
IOFileFilter gitDirFilter = (IOFileFilter) FileFilterUtils.suffixFileFilter(".git");
IOFileFilter notFile = FileFilterUtils.notFileFilter(TrueFileFilter.INSTANCE);
IOFileFilter compositeFilter = FileFilterUtils.and(notFile, gitDirFilter);
List<File> files = (List<File>) FileUtils.listFilesAndDirs(dir,compositeFilter,DirectoryFileFilter.INSTANCE);
List<String> results = new ArrayList<String>();
for(File f: files) {
try {
if(!f.getCanonicalPath().endsWith("/.git"))
continue;
String gitStripped = f.getCanonicalPath().replace("/.git", "");
System.out.println(gitStripped);
results.add(gitStripped);
} catch (IOException e) {
e.printStackTrace();
}
}
return results;
}
示例2: findFilesToAnalyze
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public static List<String> findFilesToAnalyze(String dirPath) {
IOFileFilter gitFilter = FileFilterUtils.notFileFilter(
FileFilterUtils.nameFileFilter(".git")
);
File dir = new File(dirPath);
String[] phpExt = new String[] {"php"};
IOFileFilter phpFilter = new SuffixFileFilter(phpExt, IOCase.INSENSITIVE);
List<File> files = (List<File>) FileUtils.listFiles(dir, phpFilter, gitFilter);
List<String> results = new ArrayList<String>();
for (File f : files) {
try {
results.add(f.getCanonicalPath());
} catch (IOException e) {
e.printStackTrace();
}
}
return results;
}
示例3: 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;
}
示例4: 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;
}
示例5: makeDirectoryAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of directories.
*
* @param filter The filter to make aware of directories.
* @param directoryName The directory name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeDirectoryAware( IOFileFilter filter, String directoryName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.directoryFileFilter(),
FileFilterUtils.nameFileFilter( directoryName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例6: makeFileNameAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of files.
*
* @param filter The filter to make aware of files.
* @param fileName The file name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeFileNameAware( IOFileFilter filter, String fileName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.fileFileFilter(),
FileFilterUtils.nameFileFilter( fileName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例7: makeSuffixAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of an suffix.
*
* @param filter The filter to make aware of an suffix.
* @param suffixFileName The suffix name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeSuffixAware( IOFileFilter filter, String suffixFileName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.fileFileFilter(),
FileFilterUtils.suffixFileFilter( suffixFileName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例8: makePatternFileNameAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of the given pattern.
*
* @param filter The filter to make aware of the pattern.
* @param pattern The pattern which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makePatternFileNameAware( IOFileFilter filter, String pattern )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.fileFileFilter(),
new RegexFileFilter( pattern ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例9: prepareLayoutFiles
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* This method is responsible to copy layout folder to destination directory and not copy template .html files
* @param outputDir
* @throws IOException
*/
private void prepareLayoutFiles(File outputDir) throws IOException {
URL url = getClass().getResource("/layout");
IOFileFilter notHtmlFilter = FileFilterUtils.notFileFilter(FileFilterUtils.suffixFileFilter(".html"));
FileFilter filter = FileFilterUtils.and(notHtmlFilter);
//cleanDirectory(outputDir,"/diagrams");
//cleanDirectory(outputDir,"/tables");
ResourceWriter.copyResources(url, outputDir, filter);
}
示例10: dirFilter
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter dirFilter() {
IOFileFilter makeFileFilter = FileFilterUtils.makeCVSAware(FileFilterUtils.makeSVNAware(null));
IOFileFilter metaFileFilter = new RegexPathFilter(B + X + S + "velocity" + S + "templates" + S + "meta" + S + X + E);
IOFileFilter mesaFileFilter = FileFilterUtils.notFileFilter(metaFileFilter);
IOFileFilter[] noes = new IOFileFilter[]{
new RegexFileFilter(B + "build" + E),
new RegexFileFilter(B + "dist" + E),
new RegexFileFilter(B + "private" + E),
new RegexFileFilter(B + "test" + E)
};
IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
IOFileFilter filter = FileFilterUtils.and(makeFileFilter, mesaFileFilter, noesFileFilter);
return filter;
}
示例11: map
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private boolean map() {
File rootFolder = PropertiesHandler.getRootFolder();
if (FilUtils.isNotVisibleDirectory(rootFolder)) {
return false;
}
String projectSource = rootFolder.getPath() + FILE_SEPARATOR + _project + FILE_SEPARATOR + "source";
File projectSourceFile = new File(projectSource);
if (FilUtils.isNotVisibleDirectory(projectSourceFile)) {
return false;
}
RegexFileFilter fileFilter = new RegexFileFilter("^Bundle.*\\.properties$");
RegexFileFilter dirFilter1 = new RegexFileFilter("build");
RegexFileFilter dirFilter2 = new RegexFileFilter("velocity");
IOFileFilter notFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(dirFilter1, dirFilter2));
Collection<File> bundles = FileUtils.listFiles(projectSourceFile, fileFilter, notFileFilter);
String base;
List<File> list;
for (File bundle : bundles) {
base = base(bundle);
if (_map.containsKey(base)) {
list = _map.get(base);
} else {
list = new ArrayList<>();
_map.put(base, list);
}
list.add(bundle);
}
return true;
}
示例12: dirFilter
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private IOFileFilter dirFilter() {
IOFileFilter makeCVSSVNAware = FileFilterUtils.makeCVSAware(FileFilterUtils.makeSVNAware(null));
IOFileFilter[] noes = new IOFileFilter[]{
new RegexFileFilter(B + X + D + "git" + E),
new RegexFileFilter(B + "build" + E),
new RegexFileFilter(B + "dist" + E),
new RegexFileFilter(B + "target" + E)
};
IOFileFilter noesFileFilter = FileFilterUtils.notFileFilter(FileFilterUtils.or(noes));
IOFileFilter filter = FileFilterUtils.and(makeCVSSVNAware, noesFileFilter);
return filter;
}
示例13: makeDirectoryAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of directories.
*
* @param filter The filter to make aware of directories.
* @param directoryName The directory name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeDirectoryAware( IOFileFilter filter, String directoryName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.directoryFileFilter(),
FileFilterUtils.nameFileFilter( directoryName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例14: makeFileNameAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of files.
*
* @param filter The filter to make aware of files.
* @param fileName The file name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeFileNameAware( IOFileFilter filter, String fileName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.fileFileFilter(),
FileFilterUtils.nameFileFilter( fileName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}
示例15: makeSuffixAware
import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
* Make the given IOFileFilter aware of an suffix.
*
* @param filter The filter to make aware of an suffix.
* @param suffixFileName The suffix name which should be payed attention to.
* @return The new generated filter.
*/
public static IOFileFilter makeSuffixAware( IOFileFilter filter, String suffixFileName )
{
IOFileFilter directoryAwareFilter =
FileFilterUtils.notFileFilter( FileFilterUtils.andFileFilter( FileFilterUtils.fileFileFilter(),
FileFilterUtils.suffixFileFilter( suffixFileName ) ) );
return FileFilterUtils.andFileFilter( filter, directoryAwareFilter );
}