当前位置: 首页>>代码示例>>Java>>正文


Java FileFilterUtils.or方法代码示例

本文整理汇总了Java中org.apache.commons.io.filefilter.FileFilterUtils.or方法的典型用法代码示例。如果您正苦于以下问题:Java FileFilterUtils.or方法的具体用法?Java FileFilterUtils.or怎么用?Java FileFilterUtils.or使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.io.filefilter.FileFilterUtils的用法示例。


在下文中一共展示了FileFilterUtils.or方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateConfigurationFiles

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
private void updateConfigurationFiles() throws EngineException {
	try {
		IOFileFilter fileFilter = FileFilterUtils.or(FileFilterUtils.suffixFileFilter("json"),FileFilterUtils.suffixFileFilter("xml"),FileFilterUtils.suffixFileFilter("js"));
		IOFileFilter dirFilter = FileFilterUtils.or(FileFilterUtils.nameFileFilter("config"));
		for (File f: FileUtils.listFiles(ionicWorkDir, fileFilter, dirFilter)) {
			String content = FileUtils.readFileToString(f, "UTF-8");
			content = content.replaceAll("../DisplayObjects","../../DisplayObjects");
			content = content.replaceAll("../Flashupdate","../../Flashupdate");
			writeFile(f, content, "UTF-8");
		}
		Engine.logEngine.debug("(MobileBuilder) Configuration files updated for ionic project '"+ project.getName() +"'");
	}
	catch (Exception e) {
		throw new EngineException("Unable to update configuration files for ionic project '"+ project.getName() +"'",e);
	}
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:17,代码来源:MobileBuilder.java

示例2: check1

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * 只监控文件发送变化,如果是子目录的文件改变,则目录会变,由于没有过滤目录发生变化,则目录下的文件改变不会监控到
 * @param dir
 * @throws Exception 
 */
public void check1(String dir) throws Exception
{
	File directory = new File(dir);
    // 轮询间隔 5 秒
    long interval = TimeUnit.SECONDS.toMillis(5);
    // 创建一个文件观察器用于处理文件的格式
    IOFileFilter filter=FileFilterUtils.or(FileFilterUtils.suffixFileFilter(".class"),
    		FileFilterUtils.suffixFileFilter(".jar"));
    FileAlterationObserver observer = new FileAlterationObserver(directory,filter);
    //设置文件变化监听器
    observer.addListener(new MyFileListener());
    FileAlterationMonitor monitor = new FileAlterationMonitor(interval);
    monitor.addObserver(observer);//文件观察
    monitor.start();
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:21,代码来源:FileMonitor.java

示例3: check2

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public void check2(String dir) throws Exception
	{
		File directory = new File(dir);
	    // 轮询间隔 5 秒
	    long interval = TimeUnit.SECONDS.toMillis(5);
	    //后缀过滤器
	    IOFileFilter filefilter=FileFilterUtils.or(FileFilterUtils.suffixFileFilter(".class"),
	    		FileFilterUtils.suffixFileFilter(".jar"));
	    //子目录的后缀
	    IOFileFilter subFilefilter=FileFilterUtils.or(FileFilterUtils.directoryFileFilter(),filefilter);
	    //根目录和子目录变化
	    IOFileFilter filter = FileFilterUtils.or(filefilter,subFilefilter);
	    FileAlterationObserver observer = new FileAlterationObserver(directory,filter);
	    //设置文件变化监听器
	    observer.addListener(new MyFileListener());
	    FileAlterationMonitor monitor = new FileAlterationMonitor(interval);
	    monitor.addObserver(observer);//文件观察
	    monitor.start();
//	    monitor.addObserver(observer);//文件观察,如果在start后面加,则会触发所有文件创建
	}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:21,代码来源:FileMonitor.java

示例4: buildFilterBySuffixs

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected IOFileFilter buildFilterBySuffixs(String directory,String ...suffixs)
{
    IOFileFilter iOFileFilter=FileFilterUtils.directoryFileFilter(); //子目录变化
	for(String suffix:suffixs)
	{//后缀过滤器
		iOFileFilter=FileFilterUtils.or(iOFileFilter,FileFilterUtils.suffixFileFilter(suffix));
	}
    return iOFileFilter;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:10,代码来源:DefaultClassSource.java

示例5: buildFilterByNames

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected IOFileFilter buildFilterByNames(String directory,String ...fileName)
{
    IOFileFilter iOFileFilter=FileFilterUtils.directoryFileFilter(); //子目录变化
	for(String name:fileName)
	{//名字过滤器
		iOFileFilter=FileFilterUtils.or(iOFileFilter,FileFilterUtils.nameFileFilter(name));
	}
    return iOFileFilter;
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:10,代码来源:DefaultClassSource.java

示例6: buildFileAlterationObserver

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
protected FileAlterationObserver buildFileAlterationObserver(String directory)
{
    //后缀过滤器
    IOFileFilter suffixFileFilter=FileFilterUtils.or(FileFilterUtils.suffixFileFilter(".class"),FileFilterUtils.suffixFileFilter(".jar"));
    //子目录变化
    IOFileFilter rootAndSubFilefilter=FileFilterUtils.or(FileFilterUtils.directoryFileFilter(),suffixFileFilter);
    return new FileAlterationObserver(directory,rootAndSubFilefilter);
}
 
开发者ID:juebanlin,项目名称:util4j,代码行数:9,代码来源:DefaultScriptSource.java

示例7: Get

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Builds a *VisibleFilesTraverser*.
 * @param startDirectory
 * @param ignoreFileNames
 * @return
 */
public static VisibleFilesTraverser Get(Path startDirectory, String...ignoreFileNames) {
    return new VisibleFilesTraverser(
            startDirectory,
            ignoreFileNames,
            FileFilterUtils.or(
                    // Show visible directories
                    FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), HiddenFileFilter.VISIBLE),
                    // Show visible files
                    FileFilterUtils.and(FileFilterUtils.fileFileFilter(), HiddenFileFilter.VISIBLE)
            )
    );
}
 
开发者ID:AMOSTeam3,项目名称:amos-ss15-proj3,代码行数:19,代码来源:VisibleFilesTraverser.java

示例8: processJreArchives

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Process the JRE archives (recognized JAR files are: rt.jar, jsse.jar,
 * jce.jar).
 * 
 * @param dir
 */
private void processJreArchives(String dir) {
	File directory = new File(dir);
	org.apache.commons.io.filefilter.IOFileFilter nameFilter = FileFilterUtils.or(
			FileFilterUtils.nameFileFilter("rt.jar"), FileFilterUtils.nameFileFilter("jsse.jar"),
			FileFilterUtils.nameFileFilter("jce.jar"));

	FileUtils.listFiles(directory, nameFilter, FileFilterUtils.trueFileFilter()).forEach(
			file -> processArchive(file.getPath(), false));
}
 
开发者ID:karimhamdanali,项目名称:averroes,代码行数:16,代码来源:JarOrganizer.java

示例9: TemplateWatcher

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Constructor.
 * @param manager the templating manager, to which event handling is delegated.
 * @param templateDir the templates directory to watch.
 * @param pollInterval the poll interval.
 * @throws IOException if there is a problem watching the template directory.
 */
public TemplateWatcher( final TemplatingManager manager, final File templateDir, final long pollInterval ) {
	this.templateDir = templateDir;

	// Register the custom helpers.
	this.handlebars.registerHelper( AllHelper.NAME, new AllHelper());
	this.handlebars.registerHelper( IsKeyHelper.NAME, new IsKeyHelper());

	// Pretty formatting
	this.handlebars.prettyPrint( true );

	// Create the observer, register this object as the event listener.
	FileFilter fileFilter = FileFilterUtils.or(
			FileFilterUtils.and(
					FileFilterUtils.fileFileFilter(),
					FileFilterUtils.suffixFileFilter( ".tpl" ),
					CanReadFileFilter.CAN_READ,
					new TemplateFileFilter(templateDir)),
			FileFilterUtils.and(
					FileFilterUtils.directoryFileFilter(),
					CanReadFileFilter.CAN_READ,
					new TemplateSubDirectoryFileFilter(templateDir))
	);

	FileAlterationObserver observer = new FileAlterationObserver( this.templateDir, fileFilter );
	observer.addListener( this );

	// Create the monitor.
	this.monitor = new FileAlterationMonitor( pollInterval, observer );
	this.monitor.setThreadFactory( THREAD_FACTORY );

	this.manager = manager;
	this.logger.fine( "Template watcher is watching "
			+ this.templateDir
			+ " with an interval of " + pollInterval + " ms." );
}
 
开发者ID:roboconf,项目名称:roboconf-platform,代码行数:43,代码来源:TemplateWatcher.java

示例10: fileFilterForExtension

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Setup an {@link IOFileFilter} that navigates recursively through
 * directories, returning files that match {@code extension}
 *
 * @param extension The extension (leading "." optional) to filter for
 * @return An instance of {@link IOFileFilter} to be used for a file system observer
 */
public static IOFileFilter fileFilterForExtension(String extension) {
    if (!extension.startsWith(".")) {
        extension = "." + extension;
    }
    IOFileFilter directories = defaultDirectoryFilter();
    IOFileFilter files       = FileFilterUtils.and(
            FileFilterUtils.fileFileFilter(),
            FileFilterUtils.suffixFileFilter(extension));
    return FileFilterUtils.or(directories, files);
}
 
开发者ID:semperos,项目名称:screwdriver,代码行数:18,代码来源:FileUtil.java

示例11: fileFilterForExtensions

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
public static IOFileFilter fileFilterForExtensions(List<String> extensions) {
        IOFileFilter[] fileFilters = new IOFileFilter[extensions.size()];
        for (int i = 0; i < extensions.size(); i++) {
            fileFilters[i] = fileFilterForExtension(extensions.get(i));
        }
//        IOFileFilter directories = defaultDirectoryFilter();
//        IOFileFilter files = FileFilterUtils.or(fileFilters);
        return FileFilterUtils.or(fileFilters);
    }
 
开发者ID:semperos,项目名称:screwdriver,代码行数:10,代码来源:FileUtil.java

示例12: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A <code>null</code> filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = (directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE);
        fileFilter = (fileFilter != null ? fileFilter : TrueFileFilter.TRUE);
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
开发者ID:fesch,项目名称:Moenagade,代码行数:27,代码来源:DirectoryWalker.java

示例13: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A {@code null} filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE;
        fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE;
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:27,代码来源:DirectoryWalker.java

示例14: main

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * @param args
 * @throws Exception
 */
public static void main(String[] args) throws Exception {


    // 监控根目录,会递归监控子文件夹变化

    String rootDir = "D:\\download";
    // 轮询间隔 5 秒,通过重新启动 FileAlterationMonitor 实现
    long interval = TimeUnit.SECONDS.toMillis(5);


    // 创建一个文件观察器用于处理文件的格式
    // Create a FileFilter
    IOFileFilter directories = FileFilterUtils.and(FileFilterUtils.directoryFileFilter(), HiddenFileFilter.VISIBLE);
    IOFileFilter files = FileFilterUtils.and(FileFilterUtils.fileFileFilter(), FileFilterUtils.suffixFileFilter(".java"));
    IOFileFilter filter = FileFilterUtils.or(directories, files);

    // Create the File system observer and register File Listeners
    FileAlterationObserver observer = new FileAlterationObserver(rootDir, filter, null);
    observer.addListener(new FileMonitorFileListener()); //设置文件变化监听器

    //创建文件变化监听器
    FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);

    // 开始监控
    monitor.start();

}
 
开发者ID:h819,项目名称:spring-boot,代码行数:32,代码来源:FileMonitorTest.java

示例15: DirectoryWalker

import org.apache.commons.io.filefilter.FileFilterUtils; //导入方法依赖的package包/类
/**
 * Construct an instance with a directory and a file filter and an optional
 * limit on the <i>depth</i> navigated to.
 * <p>
 * The filters control which files and directories will be navigated to as part
 * of the walk. This constructor uses {@link FileFilterUtils#makeDirectoryOnly(IOFileFilter)}
 * and {@link FileFilterUtils#makeFileOnly(IOFileFilter)} internally to combine the filters.
 * A {@code null} filter means that no filtering should occur.
 *
 * @param directoryFilter  the filter to apply to directories, null means visit all directories
 * @param fileFilter  the filter to apply to files, null means visit all files
 * @param depthLimit  controls how <i>deep</i> the hierarchy is
 *  navigated to (less than 0 means unlimited)
 */
protected DirectoryWalker(IOFileFilter directoryFilter, IOFileFilter fileFilter, final int depthLimit) {
    if (directoryFilter == null && fileFilter == null) {
        this.filter = null;
    } else {
        directoryFilter = directoryFilter != null ? directoryFilter : TrueFileFilter.TRUE;
        fileFilter = fileFilter != null ? fileFilter : TrueFileFilter.TRUE;
        directoryFilter = FileFilterUtils.makeDirectoryOnly(directoryFilter);
        fileFilter = FileFilterUtils.makeFileOnly(fileFilter);
        this.filter = FileFilterUtils.or(directoryFilter, fileFilter);
    }
    this.depthLimit = depthLimit;
}
 
开发者ID:PuppyRush,项目名称:WidgetStore,代码行数:27,代码来源:DirectoryWalker.java


注:本文中的org.apache.commons.io.filefilter.FileFilterUtils.or方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。