當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。