Java 类org.apache.commons.io.filefilter.RegexFileFilter 实例源码

项目:mobile-store    文件:App.java   
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);
            }
        }
    }
}
项目:acmeair    文件:JmeterJTLParser.java   
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();
    }
}
项目:stallion-core    文件:AsyncTaskFilePersister.java   
@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;
}
项目:PEP---Notes    文件:DataBackupIntentService.java   
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");
    }
}
  }
项目:adalid    文件:FileBrowser.java   
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;
}
项目:tassal    文件:DistinctTokenCount.java   
/**
 * @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();
}
项目:kidneyExchange    文件:PerformanceCLI.java   
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;

}
项目:fdroidclient    文件:App.java   
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);
            }
        }
    }
}
项目:kfs    文件:LaborBalanceSummaryReportServiceImpl.java   
/**
 * 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);
}
项目:oxCore    文件:FacesConfigPopulator.java   
/**
 * 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);
    }
}
项目:monasca-api    文件:ITInfluxDBTest.java   
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();

  }
项目:codemining-core    文件:DistinctTokenCount.java   
/**
 * @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();
}
项目:gocd    文件:RailsAssetsService.java   
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());
}
项目:candybean    文件:DataAdapter.java   
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;
}
项目:deadcode4j    文件:PackagingHandler.java   
/**
 * 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;
}
项目:srcgen4j-core    文件:ParameterizedTemplateParser.java   
@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;

}
项目:ctwt    文件:Actions.java   
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();
}
项目:spoofax    文件:CopyPattern.java   
@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;
}
项目:victims-plugin-jenkins-legacy    文件:VictimsPostBuildScanner.java   
/**
 * Return a list of all jars in the output directory or the specified
 * jar as a list.  As these files/directory might not prior to the
 * build we are checking their existence here rather than during the
 * configuration of the VictimsPostBuildScanner.
 * 
 * @return a list of jars to scan for vulnerabilities
 * @throws AbortException
 */
public Collection<File> listFiles(String outputDirectory) throws AbortException
{  
    File outputFile = new File(outputDirectory);
    if (!outputFile.exists()) {
        // Output file/dir should exist by now.
        throw new AbortException("Output directory/file does not exist");
    }

    if (outputFile.isFile())
    {
        Collection<File> file = new ArrayList<File>();
        file.add(outputFile);
        return file;
    }

    if (outputFile.isDirectory()) {
        Collection<File> files = FileUtils.listFiles(outputFile, new RegexFileFilter("^(.*?)\\.jar"), DirectoryFileFilter.DIRECTORY);
        return files;
    }

    // Something has gone horribly wrong
    throw new AbortException("Supplied output location is neither a file nor directory");
}
项目:anagnostes    文件:NumbersDataFetcher.java   
private List<Entry<String, String>> getAllFileNames() {
    List<Entry<String, String>> allFileNames = new ArrayList<>();
    for (String folder : getFolderNames()) {
        for (String label : m_labels) {
            String[] imageFileNames = new File(m_baseFolder + folder + File.separator + label)
                    .list(new RegexFileFilter(FILE_REGEX));
            for (String imageFileName : imageFileNames) {
                allFileNames.add(new Entry<String, String>(label,
                        m_baseFolder + folder + File.separator + label + File.separator + imageFileName));
            }
        }
    }
    return allFileNames;
}
项目:anagnostes    文件:NumbersDataFetcher.java   
private int getNumExamples(String folder) {
    int numExamples = 0;
    for (String label : m_labels) {
        numExamples += new File(m_baseFolder + folder + File.separator + label)
                .list(new RegexFileFilter(FILE_REGEX)).length;
    }
    return numExamples;
}
项目:acmeair    文件:ResultParser.java   
public void processDirectory(String dirName) {
    File root = new File(dirName);
    try {
        Collection<File> files = FileUtils.listFiles(root,
                new RegexFileFilter(getFileName()),
                DirectoryFileFilter.DIRECTORY);

        for (Iterator<File> iterator = files.iterator(); iterator.hasNext();) {
            File file = (File) iterator.next();
            processFile(file);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
项目:beyondj    文件:FileFilterHelper.java   
/**
 * 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 );
}
项目:OHMS    文件:FileUtil.java   
/**
 * Find files matching the pattern in the given directory and returns their java.io.File objects as array.
 *
 * @param dirAbsPath Absolute path of the directory.
 * @param fileNamePattern Regular expression for the file name pattern
 * @param recursive Boolean indicating whether recursive search to be made or not while finding the files.
 * @return the file[]. Returns null if either dirAbsPath is null or fileNamePattern is null or fileNamePattern is
 *         not a valid regular expression or no files matching the pattern found.
 */
public static File[] findFiles( final String dirAbsPath, final String fileNamePattern, boolean recursive )
{

    // check that dirAbsPath and fileNamePattern are not null or blank
    if ( StringUtils.isBlank( dirAbsPath ) || StringUtils.isBlank( fileNamePattern ) )
    {
        logger.warn( "In findFiles, either directory or file name pattern is null or blank."
            + " Directory: {}, FileNamePattern: {}.", dirAbsPath, fileNamePattern );
        return null;
    }

    // check that file name pattern is a valid pattern.
    if ( !FileUtil.isValidPattern( fileNamePattern ) )
    {
        logger.warn( "In findFiles, file name pattern '{}' is not a valid pattern.", fileNamePattern );
        return null;
    }

    // check that directory exists and is a directory.
    File dir = new File( dirAbsPath );
    if ( !dir.exists() || !dir.isDirectory() )
    {
        logger.warn( "In findFiles, either directory '{}' does not exists or not a directory.", dirAbsPath );
        return null;
    }
    IOFileFilter dirFilter = recursive ? TrueFileFilter.INSTANCE : null;
    Collection<File> files = FileUtils.listFiles( dir, new RegexFileFilter( fileNamePattern ), dirFilter );
    if ( files == null || files.size() == 0 )
    {
        logger.warn( "In findLatestFileByLastModified, no files found matching pattern '{}' in directory '{}'.",
                     fileNamePattern, dirAbsPath );
        return null;
    }
    return files.toArray( new File[files.size()] );
}
项目:donut-maven-plugin    文件:DonutMojo.java   
private void zipDonutReport() throws IOException, ArchiveException {
    Optional<File> file = FileUtils.listFiles(outputDirectory, new RegexFileFilter("^(.*)donut-report.html$"), TrueFileFilter.INSTANCE).stream().findFirst();
    if (!file.isPresent())
        throw new FileNotFoundException(String.format("Cannot find a donut report in folder: %s", outputDirectory.getAbsolutePath()));
    File zipFile = new File(outputDirectory, FilenameUtils.removeExtension(file.get().getName()) + ".zip");
    try (OutputStream os = new FileOutputStream(zipFile); ArchiveOutputStream aos = new ArchiveStreamFactory().createArchiveOutputStream(ArchiveStreamFactory.ZIP, os); BufferedInputStream is = new BufferedInputStream(new FileInputStream(file.get()))) {
        aos.putArchiveEntry(new ZipArchiveEntry(file.get().getName()));
        IOUtils.copy(is, aos);
        aos.closeArchiveEntry();
        aos.finish();
    }
}
项目:Neutrino-Search-Engine    文件:IndexedFile.java   
/**
 * Return all local text files.
 *
 * @param dir the directory you are searching in
 * @param documentFilter the regex filter string to select only text files or html files
 * @return the linked list with all html files in the directory
 */
public static LinkedList<File> returnAllFiles(String dir, String documentFilter) {
    File directory = new File(dir);

    Collection files = FileUtils.listFiles(directory, new RegexFileFilter(documentFilter), TrueFileFilter.INSTANCE);
    LinkedList<File> result = (LinkedList<File>) files;

    return result;
}
项目:cerberus-lifecycle-cli    文件:UploadCertFilesPathValidator.java   
@Override
public void validate(final String name, final Path value) throws ParameterException {

    if (value == null) {
        throw new ParameterException("Value must be specified.");
    }

    final File certDirectory = value.toFile();
    final Set<String> filenames = Sets.newHashSet();

    if (!certDirectory.canRead()) {
        throw new ParameterException("Specified path is not readable.");
    }

    if (!certDirectory.isDirectory()) {
        throw new ParameterException("Specified path is not a directory.");
    }


    final FilenameFilter filter = new RegexFileFilter("^.*\\.pem$");
    final File[] files = certDirectory.listFiles(filter);
    Arrays.stream(files).forEach(file -> filenames.add(file.getName()));

    if (!filenames.containsAll(EXPECTED_FILE_NAMES)) {
        final StringJoiner sj = new StringJoiner(", ", "[", "]");
        EXPECTED_FILE_NAMES.stream().forEach(sj::add);
        throw new ParameterException("Not all expected files are present! Expected: " + sj.toString());
    }
}
项目:i18n-props-xls-converter    文件:I18nConverterImpl.java   
private Collection<File> getFilesWithSorted(final String fileRegularExpression,
    final File workingDirectoryFile) {
  Collection<File> files = FileUtils.listFiles(workingDirectoryFile,
      new RegexFileFilter(fileRegularExpression),
      DirectoryFileFilter.DIRECTORY);

  if (files instanceof List<?>) {
    // guarantees that the first file is the default language file.
    Collections.sort((List<File>) files,
        (file1, file2) -> file1.getName().compareTo(file2.getName()));
  }
  return files;
}
项目:me3modmanager    文件:ModManager.java   
/**
 * Returns map of Custom DLC files mapped to a list of custom dlc they
 * appear in. If the list is longer than 1 element it means there is a
 * conflict. Only scans for PCC files. The returned values are sorted in
 * order of lowest to highest priority.
 *
 * @param customDLCs
 *            list of Custom DLCs to scan against
 * @param dlcdirectory
 *            DLC directory of ME3
 * @return map of conflicts, or null if exception occurs.
 */
public static HashMap<String, ArrayList<CustomDLC>> getCustomDLCConflicts(ArrayList<CustomDLC> customDLCs, String dlcdirectory) {
    try {
        Collections.sort(customDLCs);

        //prepare list of folders
        HashMap<String, ArrayList<CustomDLC>> filesMap = new HashMap<>();
        ArrayList<String> customDLCFolders = new ArrayList<String>();
        for (CustomDLC dlc : customDLCs) {
            customDLCFolders.add(dlcdirectory + dlc.getDlcName());
        }

        //construct lists of what custom dlc each file appears in
        for (CustomDLC custDLC : customDLCs) {
            String dlcFolder = ResourceUtils.normalizeFilePath(dlcdirectory + custDLC.getDlcName() + File.separator, true);
            Collection<File> files = FileUtils.listFiles(new File(dlcFolder), new RegexFileFilter("^(.*?)"), DirectoryFileFilter.DIRECTORY);
            for (File file : files) {
                if (!FilenameUtils.getExtension(file.getAbsolutePath().toLowerCase()).equals("pcc")) {
                    continue;
                }
                String filename = FilenameUtils.getName(file.getAbsolutePath());
                ArrayList<CustomDLC> dlcFileAppearsIn = null;
                boolean keyExists = filesMap.containsKey(filename);
                if (keyExists) {
                    //conflict
                    dlcFileAppearsIn = filesMap.get(filename);

                } else {
                    dlcFileAppearsIn = new ArrayList<>();
                }
                dlcFileAppearsIn.add(custDLC);
                filesMap.put(filename, dlcFileAppearsIn);
            }
        }
        return filesMap;
    } catch (Exception e) {
        ModManager.debugLogger.writeErrorWithException("Error getting DLC conflict list:", e);
    }
    return null;
}
项目:acquisition-server    文件:RaqetSteps.java   
private File[] getMatchingFiles(final AlternateMountPath mount, final String regexp) {
    final File base = SEARCHPATHS.get(mount);
    final File caseDir = new File(base, _caseName);
    final File dir = new File(caseDir, _computerName);

    final FilenameFilter filter = new RegexFileFilter(regexp);

    return dir.listFiles(filter);
}
项目:adalid    文件:MetaFolderSql.java   
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;
}
项目:adalid    文件:Mapper.java   
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;
}
项目:adalid    文件:FileBrowser.java   
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;
}
项目:eseo-spyware    文件:FSManager.java   
/**
 * Get files from directory and subdirectories
 *
 * @param file
 * @return list files
    */
private List<File> listFiles(final File file) {
    List<File> files = new ArrayList<>();
    if (file.isDirectory()) {
        files.addAll(FileUtils.listFiles(file, new RegexFileFilter("^(.*?)"), DirectoryFileFilter.DIRECTORY));
    } else {
        files.add(file);
    }
    return files;
}
项目:Wilma    文件:FileUtils.java   
/**
 * Collects the file names in the target folder and it's child folders.
 * @param folder is the target folder
 * @return with the file names
 */
public Collection<File> listFiles(final File folder) {
    Collection<File> result;
    try {
        result = org.apache.commons.io.FileUtils.listFiles(folder, new RegexFileFilter("^(.*?)"), DirectoryFileFilter.DIRECTORY);
    } catch (IllegalArgumentException e) {
        result = logAndReturnEmptyList(folder, e);
    }
    return result;
}
项目:Wilma    文件:FileUtils.java   
/**
 * 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;
}
项目:appassembler    文件:FileFilterHelper.java   
/**
 * 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 );
}
项目:product-iots    文件:CarbonServerManagerExtension.java   
/**
 * To check jacoco file sizes and wait for them to get created..
 *
 * @param filePath File Path of the jacoco data files.
 */
private void checkJacocoDataFileSizes(String filePath) {
    Collection<File> fileSetsCollection = FileUtils
            .listFiles(new File(filePath), new RegexFileFilter("[^s]+(." + "(?i)(exec))$"),
                    DirectoryFileFilter.DIRECTORY);

    for (File inputFile : fileSetsCollection) {
        if (inputFile.isDirectory()) {
            continue;
        }
        //retry to check whether exec data file is non empty.
        waitForCoverageDumpFileCreation(inputFile);
    }
}
项目:codemining-sequencelm    文件:ImportCrossEntropyDsetExtractor.java   
void printDataForAllFiles(final File directory) {
    for (final File f : FileUtils.listFiles(directory, new RegexFileFilter(
            ".*\\.java$"), DirectoryFileFilter.DIRECTORY)) {
        try {
            getDataForFile(f);
        } catch (IOException e) {
            LOGGER.warning(ExceptionUtils.getFullStackTrace(e));
        }

    }
}
项目:varOne    文件:ThreadPoolMetricsReaderTest.java   
/**
 * Test method for {@link com.varone.node.reader.ThreadPoolMetricsReader#read(java.lang.String, java.lang.String)}.
 * @throws IOException 
 */
public void testRead_THREAD_POOL() throws IOException {
    MetricsReader reader = new ThreadPoolMetricsReader(null, MetricsType.THREAD_POOL);

    String applicationId = "application_1439169262151_0237";
    String metricsDir = this.getClass().getResource("/csvsink").getPath();

    Map<String, List<MetricTuple>> result = reader.read(applicationId, metricsDir);
    IOFileFilter filter = new RegexFileFilter(applicationId+"(.\\d+).executor.threadpool.*\\.csv");

    assertEquals(result.size(), 8);  
    this.assertContent(filter, result);
}