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


Java RegexFileFilter类代码示例

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


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

示例1: processResultsDirectory

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
public void processResultsDirectory(String dirName) {
	File root = new File(dirName);
	try {
		Collection<File> files = FileUtils.listFiles(root,
				new RegexFileFilter(jmeterJTLFileName),
				DirectoryFileFilter.DIRECTORY);

		for (Iterator<File> iterator = files.iterator(); iterator.hasNext();) {
			File file = (File) iterator.next();
			parse(file);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:WillemJiang,项目名称:acmeair,代码行数:16,代码来源:JmeterJTLParser.java

示例2: initInstalledObbFiles

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
public static void initInstalledObbFiles(Apk apk) {
    File obbdir = getObbDir(apk.packageName);
    FileFilter filter = new RegexFileFilter("(main|patch)\\.[0-9-][0-9]*\\." + apk.packageName + "\\.obb");
    File[] files = obbdir.listFiles(filter);
    if (files == null) {
        return;
    }
    Arrays.sort(files);
    for (File f : files) {
        String filename = f.getName();
        String[] segments = filename.split("\\.");
        if (Integer.parseInt(segments[1]) <= apk.versionCode) {
            if ("main".equals(segments[0])) {
                apk.obbMainFile = filename;
                apk.obbMainFileSha256 = Utils.getBinaryHash(f, apk.hashType);
            } else if ("patch".equals(segments[0])) {
                apk.obbPatchFile = filename;
                apk.obbPatchFileSha256 = Utils.getBinaryHash(f, apk.hashType);
            }
        }
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:23,代码来源:App.java

示例3: fetchAll

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
@Override
public List fetchAll() {
    File[] folders = new File[]{
            new File(getBucketFolderPath()),
            new File(getBucketFolderPath() + "/locked"),
            new File(getBucketFolderPath() + "/pending"),
            new File(getBucketFolderPath() + "/failed"),
            new File(getBucketFolderPath() + "/completed"),
            new File(getBucketFolderPath() + "/manualRetry")
    };
    for(File folder: folders) {
        if (!folder.isDirectory()) {
            folder.mkdirs();
        }
    }
    FileFilter fileFilter = new RegexFileFilter("\\d+\\d+\\d+\\d+.*\\.json");
    File root = new File(getBucketFolderPath() + "/pending");
    File[] files = root.listFiles(fileFilter);
    List items = new ArrayList<>();
    for (File file : files) {
        items.add(fetchOne(file.getAbsolutePath()));
    }
    return items;
}
 
开发者ID:StallionCMS,项目名称:stallion-core,代码行数:25,代码来源:AsyncTaskFilePersister.java

示例4: importNotes

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
private void importNotes(File backupDir) {
for (File file : FileUtils.listFiles(backupDir, new RegexFileFilter("\\d{13}"), TrueFileFilter.INSTANCE)) {
	try {
		Note note = new Note();
		note.buildFromJson(FileUtils.readFileToString(file));
		if (note.getCategory() != null) {
			DbHelper.getInstance().updateCategory(note.getCategory());
		}
		for (Attachment attachment : note.getAttachmentsList()) {
			DbHelper.getInstance().updateAttachment(attachment);
		}
		DbHelper.getInstance().updateNote(note, false);
	} catch (IOException e) {
		Log.e(Constants.TAG, "Error parsing note json");
	}
}
  }
 
开发者ID:ApplicationFactory,项目名称:PEP---Notes,代码行数:18,代码来源:DataBackupIntentService.java

示例5: fileFilter

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的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;
}
 
开发者ID:proyecto-adalid,项目名称:adalid,代码行数:23,代码来源:FileBrowser.java

示例6: main

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
/**
 * @param args
 * @throws ClassNotFoundException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
public static void main(final String[] args) throws InstantiationException,
		IllegalAccessException, ClassNotFoundException {

	if (args.length != 2) {
		System.err.println("Usage: <directory> <tokenizerClass>");
		return;
	}

	final DistinctTokenCount tokCount = new DistinctTokenCount(args[1]);
	for (final File fi : FileUtils.listFiles(new File(args[0]),
			new RegexFileFilter(".*\\.java$"),
			DirectoryFileFilter.DIRECTORY)) {
		try {
			tokCount.addTokens(fi);
		} catch (final IOException e) {
			LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
		}
	}

	tokCount.printCounts();
}
 
开发者ID:mast-group,项目名称:tassal,代码行数:28,代码来源:DistinctTokenCount.java

示例7: makeDefaultInstances

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
private List<String> makeDefaultInstances() {
  List<String> ans = Lists.newArrayList();
  String path = "kepLibInstances";
  File dir = new File(path);
  if (!dir.isDirectory()) {
    System.out
        .println("Directory kepLibInstances not found, looking for files in working directory instead.");
    path = ".";
  }
  String fileName = ".*.csv";

  System.out.println("path:" + path);
  System.out.println("fileName:" + fileName);
  // fileName = fileName.replaceAll("\\*", "\\.\\*");
  // System.out.println("fileNameJavaregex:" + fileName);

  Collection<File> files = FileUtils.listFiles(new File(path),
      new RegexFileFilter(fileName), null);
  for (File file : files) {
    ans.add(file.getPath());
  }
  System.out.println("Found " + files.size() + " files.");
  return ans;

}
 
开发者ID:rma350,项目名称:kidneyExchange,代码行数:26,代码来源:PerformanceCLI.java

示例8: generatePosterOutputSummaryReport

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
/**
 * Generates reports about the output of a poster run.
 * 
 * @param runDate the date the poster was run.
 */
protected void generatePosterOutputSummaryReport(Date runDate) {
    PosterOutputSummaryReport posterOutputSummaryReport = new PosterOutputSummaryReport();
    
    // summarize all the entries for the main poster
    File mainPosterFile = FileUtil.getNewestFile(new File(batchFileDirectoryName), new RegexFileFilter((LaborConstants.BatchFileSystem.POSTER_INPUT_FILE + "\\.[0-9_\\-]+\\" + GeneralLedgerConstants.BatchFileSystem.EXTENSION)));        
    if (mainPosterFile != null && mainPosterFile.exists()) {
        LaborOriginEntryFileIterator mainPosterIterator = new LaborOriginEntryFileIterator(mainPosterFile);
        while (mainPosterIterator.hasNext()) {
            OriginEntryInformation originEntry = mainPosterIterator.next();
            posterOutputSummaryReport.summarize(originEntry);
        }
    } else {
        LOG.warn("Could not Main Poster Input file, "+ LaborConstants.BatchFileSystem.POSTER_INPUT_FILE + ", for tabulation in the Poster Output Summary Report");
    }
    
    posterOutputSummaryReport.writeReport(laborPosterOutputSummaryReportWriterService);
}
 
开发者ID:kuali,项目名称:kfs,代码行数:23,代码来源:LaborBalanceSummaryReportServiceImpl.java

示例9: findAndUpdateNavigationRules

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
/**
 * Recursively finds all *.navigation.xml files located in custom pages directory, and adds navigation rules to
 * navigation handler
 *
 * @param path to custom pages directory
 * @throws Exception
 */
private void findAndUpdateNavigationRules(Document toPopulate, String path) throws Exception {
    File file = new File(path);
    RegexFileFilter regexFileFilter = new RegexFileFilter(FACES_CONFIG_PATTERN);
    Collection<File> facesConfigFiles = FileUtils.listFiles(file, regexFileFilter, DirectoryFileFilter.DIRECTORY);
    log.debug("Found '{}' navigation rules files", facesConfigFiles.size());

    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();

    for (File files : facesConfigFiles) {
        String faceConfig = files.getAbsolutePath();
        updateDocument(toPopulate, builder, faceConfig);
        log.debug("Added navigation rules from {}", faceConfig);
    }
}
 
开发者ID:GluuFederation,项目名称:oxCore,代码行数:24,代码来源:FacesConfigPopulator.java

示例10: getLatestShadedJarFileName

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
private String getLatestShadedJarFileName() {

    File dir = new File("./target");
    FileFilter fileFilter = new RegexFileFilter("^mon-api-0\\.1\\.0-(\\d|\\w)+-(\\d|\\w)+\\.jar");
    File[] files = dir.listFiles(fileFilter);
    if (files.length == 0) {
      System.err.println("Failed to find shaded jar. You must build mon-api before running this "
                         + "test. Try 'mvn clean package'");
      tearDown();
      System.exit(-1);
    }
    System.out.println("Found " + files.length + " jar files");
    File latestFile = files[0];
    for (File file : files) {
      if (file.lastModified() > latestFile.lastModified()) {
        latestFile = file;
      }
    }

    System.out.println(latestFile.getName() + " is the latest jar file");
    return latestFile.getName();

  }
 
开发者ID:openstack,项目名称:monasca-api,代码行数:24,代码来源:ITInfluxDBTest.java

示例11: initialize

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
public void initialize() throws IOException {
    if (!systemEnvironment.useCompressedJs()) {
        return;
    }
    String assetsDirPath = servletContext.getRealPath(servletContext.getInitParameter("rails.root") + "/public/assets/");
    File assetsDir = new File(assetsDirPath);
    if (!assetsDir.exists()) {
        throw new RuntimeException(String.format("Assets directory does not exist %s", assetsDirPath));
    }
    Collection files = FileUtils.listFiles(assetsDir, new RegexFileFilter(MANIFEST_FILE_PATTERN), null);
    if (files.isEmpty()) {
        throw new RuntimeException(String.format("Manifest json file was not found at %s", assetsDirPath));
    }

    File manifestFile = (File) files.iterator().next();

    LOG.info("Found rails assets manifest file named {} ", manifestFile.getName());
    String manifest = FileUtils.readFileToString(manifestFile, UTF_8);
    Gson gson = new Gson();
    railsAssetsManifest = gson.fromJson(manifest, RailsAssetsManifest.class);
    LOG.info("Successfully read rails assets manifest file located at {}", manifestFile.getAbsolutePath());
}
 
开发者ID:gocd,项目名称:gocd,代码行数:23,代码来源:RailsAssetsService.java

示例12: getAllFilesBasedOnPattern

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
protected static File[] getAllFilesBasedOnPattern(String fileFullDirPath,
		String testData, String ext) {
	File dir = new File(fileFullDirPath);
	File[] files;

	String pattern = testData + "." + ext + "|" + testData + "_[^_]+" + "."
			+ ext;
	
	if (selection == DataAdapter.Selection.SINGLE) {
		pattern = testData + "." + ext;
	}
	
	// System.out.println("\nFiles that match regular expression: " +
	// pattern);
	FileFilter filter = new RegexFileFilter(pattern);
	files = dir.listFiles(filter);

	return files;
}
 
开发者ID:sugarcrm,项目名称:candybean,代码行数:20,代码来源:DataAdapter.java

示例13: getJavaFilesOfCompileSourceRootsAsRepositories

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
/**
 * Returns each compile source root of a given <code>MavenProject</code> as a <code>Repository</code> instance
 * providing access to the Java files it contains.
 * Silently ignores compile source roots that do not exist in the file system.
 *
 * @since 2.0.0
 */
@Nonnull
protected Collection<Repository> getJavaFilesOfCompileSourceRootsAsRepositories(@Nonnull MavenProject project) {
    Collection<Repository> codeRepositories = newArrayList();
    for (String compileSourceRoot : emptyIfNull(project.getCompileSourceRoots())) {
        File compileSourceDirectory = new File(compileSourceRoot);
        if (!compileSourceDirectory.exists()) {
            logger.debug("  Compile Source Directory [{}] does not exist?", compileSourceDirectory);
            continue;
        }
        codeRepositories.add(new Repository(compileSourceDirectory,
                new OrFileFilter(DIRECTORY, new RegexFileFilter(".*\\.java$", INSENSITIVE))));
        logger.debug("  Found source directory [{}].", compileSourceRoot);
    }
    return codeRepositories;
}
 
开发者ID:ImmobilienScout24,项目名称:deadcode4j,代码行数:23,代码来源:PackagingHandler.java

示例14: initialize

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
@Override
public void initialize(final SrcGen4JContext context,
        final ParserConfig config) {

    // This type of parser always needs a configuration
    Contract.requireArgNotNull("config", config);

    name = config.getName();
    varMap = config.getParent().getVarMap();

    LOG.debug("Initialize parser: " + name);

    parserConfig = getConcreteConfig(config);
    modelFilter = new RegexFileFilter(parserConfig.getModelFilter());
    templateFilter = new RegexFileFilter(parserConfig.getTemplateFilter());
    fileFilter = new OrFileFilter(modelFilter, templateFilter);

    this.context = context;

}
 
开发者ID:fuinorg,项目名称:srcgen4j-core,代码行数:21,代码来源:ParameterizedTemplateParser.java

示例15: buildTrainingDataFromCorpus

import org.apache.commons.io.filefilter.RegexFileFilter; //导入依赖的package包/类
public static void buildTrainingDataFromCorpus(String dataSetName,
        File corpusRoot, FVGenerator fvGenerator, File dest)
        throws IOException {
    Collection<File> children = FileUtils.listFiles(corpusRoot,
            new RegexFileFilter(".+\\.txt", IOCase.INSENSITIVE), DirectoryFileFilter.INSTANCE);

    ArffSaver saver = new ArffSaver();
    saver.setFile(dest);
    saver.setRetrieval(Saver.INCREMENTAL);
    boolean first = true;
    for (File textFile : children) {

        Instances dataSet = buildTrainingDataFromFile(dataSetName, textFile, fvGenerator);

        if (first) {
            saver.setStructure(dataSet);

            first = false;
        }
        for (int i = 0; i < dataSet.numInstances(); ++i) {
            saver.writeIncremental(dataSet.instance(i));
        }

    }
    saver.getWriter().flush();
}
 
开发者ID:wittawatj,项目名称:ctwt,代码行数:27,代码来源:Actions.java


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