本文整理汇总了Java中org.apache.commons.io.filefilter.FalseFileFilter类的典型用法代码示例。如果您正苦于以下问题:Java FalseFileFilter类的具体用法?Java FalseFileFilter怎么用?Java FalseFileFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FalseFileFilter类属于org.apache.commons.io.filefilter包,在下文中一共展示了FalseFileFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeUselessPages
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
private void removeUselessPages(ApplicationComponent application) {
if (application != null) {
File ionicPagesDir = new File(ionicWorkDir,"src/pages");
List<String> pageDirectories = new ArrayList<String>();
pageDirectories.add(ionicPagesDir.getAbsolutePath());
List<PageComponent> pages = application.getPageComponentList();
for (PageComponent page : pages) {
File pageDir = new File(ionicPagesDir, page.getName());
pageDirectories.add(pageDir.getAbsolutePath());
}
for (File dir: FileUtils.listFilesAndDirs(ionicPagesDir, FalseFileFilter.INSTANCE, DirectoryFileFilter.DIRECTORY)) {
if (!pageDirectories.contains(dir.getAbsolutePath())) {
try {
FileUtils.deleteDirectory(dir);
}
catch(Exception e) {}
}
}
}
}
示例2: listRootDirs
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
/**
* Get list of all existing root sub directories
*
* @param rootDir
* - the root directory to list
* @return list of sub directories
*/
public static Collection<File> listRootDirs(final File rootDir) {
final Collection<File> dirList = new ArrayList<File>();
for (final File dir : FileUtils.listFilesAndDirs(rootDir, FalseFileFilter.INSTANCE,
DirectoryFileFilter.INSTANCE)) {
LOG.debug("Dir: {}", dir);
// get only root directories
final String name = getTemplateName(rootDir, dir);
if (StringUtils.isNotBlank(name) && !name.contains("/")) {
dirList.add(dir);
}
}
return dirList;
}
示例3: receiveFiles
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
public void receiveFiles(TransferJob job) throws FileNotFoundException, Exception{
final String pattern = job.getSourceFilepattern();
final URI url = new URI(job.getSourceUrl());
final String path = url.getPath();
final Long fileage = 100L;
Collection<File> files = FileUtils.listFiles(new File(path), new FileReceiveFilter(fileage, pattern), FalseFileFilter.INSTANCE);
log.debug("{} file found for job {}",files.size(),job.getName());
for(File file : files){
log.debug("Processing: {}",file.getCanonicalPath());
queueFile(job,file);
file.delete();
}
}
示例4: stampOf
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
@Override public Stamp stampOf(File directory) {
if(!directory.exists()) {
return new ValueStamp<>(this, -1L);
} else if(!directory.isDirectory()) {
throw new RuntimeException("Directory stamper cannot stamp " + directory + ", it is not a directory");
} else if(filter != null && fileStamper != null) {
final Map<File, Stamp> stamps = Maps.newHashMap();
final Collection<File> files = FileUtils.listFiles(directory, filter, FalseFileFilter.INSTANCE);
for(File file : files) {
stamps.put(file, fileStamper.stampOf(file));
}
return new ValueStamp<>(this, stamps);
} else {
return new ValueStamp<>(this, directory.lastModified());
}
}
示例5: build
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
@Override public None build(Input input) throws IOException {
requireBuild(input.origin);
require(input.srcDir, new DirectoryModifiedStamper());
final Collection<File> files =
FileUtils.listFiles(input.srcDir, new RegexFileFilter(input.pattern), FalseFileFilter.INSTANCE);
for(File file : files) {
require(file);
final File dstFile = new File(input.dstDir, file.getName());
FileUtils.copyFile(file, dstFile);
provide(dstFile);
}
return None.val;
}
示例6: listFiles
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
/**
* Finds files within a given directory (and optionally its
* subdirectories). All files found are filtered by an IOFileFilter.
* <p>
* If your search should recurse into subdirectories you can pass in
* an IOFileFilter for directories. You don't need to bind a
* DirectoryFileFilter (via logical AND) to this filter. This method does
* that for you.
* <p>
* An example: If you want to search through all directories called
* "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code>
* <p>
* Another common usage of this method is find files in a directory
* tree but ignoring the directories generated CVS. You can simply pass
* in <code>FileFilterUtils.makeCVSAware(null)</code>.
*
* @param directory the directory to search in
* @param fileFilter filter to apply when finding files.
* @param dirFilter optional filter to apply when finding subdirectories.
* If this parameter is <code>null</code>, subdirectories will not be included in the
* search. Use TrueFileFilter.INSTANCE to match all directories.
* @return an collection of java.io.File with the matching files
* @see org.apache.commons.io.filefilter.FileFilterUtils
* @see org.apache.commons.io.filefilter.NameFileFilter
*/
public static Collection<File> listFiles(
File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException(
"Parameter 'directory' is not a directory");
}
if (fileFilter == null) {
throw new NullPointerException("Parameter 'fileFilter' is null");
}
//Setup effective file filter
IOFileFilter effFileFilter = FileFilterUtils.and(fileFilter,
FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));
//Setup effective directory filter
IOFileFilter effDirFilter;
if (dirFilter == null) {
effDirFilter = FalseFileFilter.INSTANCE;
} else {
effDirFilter = FileFilterUtils.and(dirFilter,
DirectoryFileFilter.INSTANCE);
}
//Find files
Collection<File> files = new java.util.LinkedList<File>();
innerListFiles(files, directory,
FileFilterUtils.or(effFileFilter, effDirFilter));
return files;
}
示例7: searchPrefixFile
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
/**
* 查找需要合并文件的临时文件信息
*
* @param directory 临时文件所在的目录
* @param prefix 临时文件的前缀
* @param caseSensitivity 临时文件的大小写敏感
* @return collection
*/
public static Collection<File> searchPrefixFile(File directory, String prefix, boolean
caseSensitivity) {
IOCase iocase = IOCase.INSENSITIVE;
if (caseSensitivity) {
iocase = IOCase.SENSITIVE;
}
//创建相关的过滤器
IOFileFilter fileFilter = FileFilterUtils.prefixFileFilter(prefix, iocase);
//检查相关的过滤信息
return FileUtils.listFiles(directory, fileFilter, FalseFileFilter.INSTANCE);
}
示例8: setUp
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
protected void setUp() throws Exception {
File root1 = new File( "data/VBox" );
if( !root1.isDirectory() )
return;
Collection<File> c1 = FileUtils.listFilesAndDirs
( root1, FalseFileFilter.INSTANCE, TrueFileFilter.INSTANCE );
File root2 = new File( "data/vmware" );
if( !root2.isDirectory() )
return;
Collection<File> c2 = FileUtils.listFilesAndDirs
( root2, FalseFileFilter.INSTANCE, TrueFileFilter.INSTANCE );
fs = new ArrayList<File>();
fs.addAll( c1 );
fs.addAll( c2 );
}
示例9: getFrameworks
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
private static List<File> getFrameworks(File appDir) {
List<File> frameworks = new ArrayList<>();
File frameworkDir = new File(appDir, "Frameworks");
if (frameworkDir.exists()) {
Collection<File> files = FileUtils.listFilesAndDirs(frameworkDir, FalseFileFilter.INSTANCE, FileFilterUtils.suffixFileFilter(".framework"));
for (File file : files) {
if (!file.equals(frameworkDir)) {
frameworks.add(file);
}
}
frameworks.addAll(FileUtils.listFiles(frameworkDir, FileFilterUtils.suffixFileFilter(".dylib"), null));
}
return frameworks;
}
示例10: compileTLK
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
private static void compileTLK(String path) throws IOException, InterruptedException {
File dir = new File(path);
System.out.println(dir);
Collection<File> files = FileUtils.listFiles(dir, new SuffixFileFilter(".xml"), FalseFileFilter.FALSE);
for (File file : files) {
System.out.println(file.getAbsolutePath());
}
for (File f : files) {
ArrayList<String> commandBuilder = new ArrayList<String>();
String compilerPath = ModManager.getTankMasterTLKDir() + "MassEffect3.TlkEditor.exe";
commandBuilder.add(compilerPath);
commandBuilder.add(f.getAbsolutePath());
commandBuilder.add(f.getParent() + File.separator + FilenameUtils.getBaseName(f.getAbsolutePath()) + ".xml");
commandBuilder.add("--mode");
commandBuilder.add("ToTlk");
commandBuilder.add("--no-ui");
String[] command = commandBuilder.toArray(new String[commandBuilder.size()]);
//Debug stuff
StringBuilder sb = new StringBuilder();
for (String arg : command) {
sb.append(arg + " ");
}
Process p = null;
System.out.println("Executing: " + sb.toString());
ProcessBuilder pb = new ProcessBuilder(command);
pb.redirectErrorStream(true);
p = pb.start();
p.waitFor();
}
}
示例11: listFilesWithFilter
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
/**
* Collects the file names in the target folder with the given filter in non recursive way.
* @param folder is the target folder
* @param filter is the regular expression of filtering logic
* @return with the file names
*/
public Collection<File> listFilesWithFilter(final File folder, final String filter) {
Collection<File> result;
try {
result = org.apache.commons.io.FileUtils.listFiles(folder, new RegexFileFilter(filter), FalseFileFilter.INSTANCE);
} catch (IllegalArgumentException e) {
result = logAndReturnEmptyList(folder, e);
}
return result;
}
示例12: listFiles
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
/**
* <p>Finds files within a given directory (and optionally its
* subdirectories). All files found are filtered by an IOFileFilter.
* </p>
* <p>If your search should recurse into subdirectories you can pass in
* an IOFileFilter for directories. You don't need to bind a
* DirectoryFileFilter (via logical AND) to this filter. This method does
* that for you.
* </p>
* <p>An example: If you want to search through all directories called
* "temp" you pass in <code>FileFilterUtils.NameFileFilter("temp")</code>
* </p>
* <p>Another common usage of this method is find files in a directory
* tree but ignoring the directories generated CVS. You can simply pass
* in <code>FileFilterUtils.makeCVSAware(null)</code>.
* </p>
* @param directory the directory to search in
* @param fileFilter filter to apply when finding files.
* @param dirFilter optional filter to apply when finding subdirectories.
* If this parameter is null, subdirectories will not be included in the
* search. Use TrueFileFilter.INSTANCE to match all directories.
* @return an collection of java.io.File with the matching files
* @see org.apache.commons.io.filefilter.FileFilterUtils
* @see org.apache.commons.io.filefilter.NameFileFilter
*/
public static Collection listFiles(File directory, IOFileFilter fileFilter, IOFileFilter dirFilter) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("Parameter 'directory' is not a directory");
}
if (fileFilter == null) {
throw new NullPointerException("Parameter 'fileFilter' is null");
}
//Setup effective file filter
IOFileFilter effFileFilter = FileFilterUtils.andFileFilter(fileFilter,
FileFilterUtils.notFileFilter(DirectoryFileFilter.INSTANCE));
//Setup effective directory filter
IOFileFilter effDirFilter;
if (dirFilter == null) {
effDirFilter = FalseFileFilter.INSTANCE;
} else {
effDirFilter = FileFilterUtils.andFileFilter(dirFilter,
DirectoryFileFilter.INSTANCE);
}
//Find files
Collection files = new java.util.LinkedList();
innerListFiles(files, directory,
FileFilterUtils.orFileFilter(effFileFilter, effDirFilter));
return files;
}
示例13: version32to53
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
void version32to53() {
Collection folders = FileUtils.listFilesAndDirs(Storage.getRoot(), FalseFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
for (Object folderObject : folders) { //Search for dirs in root
File folder = (File) folderObject;
if (new File(folder, ".vault").exists() || !new File(folder, ".nomedia").exists()) {
appendlog("\n" + folder.getAbsolutePath() + " is 5.x or not a vault, skip");
continue; //The whole thing should be skipped because vault is in 5.x standard.
}
appendlog("\n" + folder.getAbsolutePath() + " is pre-5.x");
Collection files = FileUtils.listFiles(folder, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
//walks the whole file tree, find out files that do not have encoded file names
//and encode them.
for (Object file : files) {
File realFile = (File) file;
if (".nomedia".equals(realFile.getName()))
continue;
String fileName = FilenameUtils.removeExtension(realFile.getName());
fileName = fileName.replace("_thumb", "");
try {
Base64Coder.decodeString(fileName);
} catch (IllegalArgumentException e) {
String encodedFileName = Base64Coder.encodeString(fileName);
fileName = realFile.getAbsolutePath().replace(fileName, encodedFileName);
realFile.renameTo(new File(fileName));
}
}
}
version53to60();
}
示例14: getAddonJarFiles
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
private List<File> getAddonJarFiles() {
File addonsPath = new File(systemEnvironment.get(SystemEnvironment.ADDONS_PATH));
if (!addonsPath.exists() || !addonsPath.canRead()) {
return new ArrayList<>();
}
return new ArrayList<>(FileUtils.listFiles(addonsPath, new SuffixFileFilter("jar", IOCase.INSENSITIVE), FalseFileFilter.INSTANCE));
}
示例15: startTailers
import org.apache.commons.io.filefilter.FalseFileFilter; //导入依赖的package包/类
private void startTailers() throws FileNotFoundException
{
String filename = filePath.substring(filePath.lastIndexOf('/') + 1);
File directory = new File(filePath.substring(0, filePath.lastIndexOf('/')));
if (!directory.exists())
{
if (!directoryNotFound)
{
LOG.warn("Directory {} does not exist, waiting for it to be created", directory.getAbsolutePath());
directoryNotFound = true;
}
throw new FileNotFoundException("Directory " + directory.getAbsolutePath() + " does not exist");
}
if (directoryNotFound)
{
LOG.warn("Directory {} created", directory.getAbsolutePath());
directoryNotFound = false;
}
Collection<File> files = FileUtils.listFiles(
directory,
new WildcardFileFilter(filename),
FalseFileFilter.INSTANCE
);
for (File file : files)
{
startTailer(file, false);
}
}