Example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

List of usage examples for org.apache.commons.io.filefilter TrueFileFilter INSTANCE

Introduction

In this page you can find the example usage for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Prototype

IOFileFilter INSTANCE

To view the source code for org.apache.commons.io.filefilter TrueFileFilter INSTANCE.

Click Source Link

Document

Singleton instance of true filter.

Usage

From source file:com.kelveden.rastajax.cli.Runner.java

private static List<URL> getClasspathURLs(File workingDirectory) throws CliExecutionException {

    final File classesFolder = new File(workingDirectory, "WEB-INF/classes");
    final File libFolder = new File(workingDirectory, "WEB-INF/lib");

    final List<URL> urls = new ArrayList<URL>();
    try {//from  ww  w  . j a  v a 2  s .c o m
        urls.add(classesFolder.toURI().toURL());

    } catch (final MalformedURLException e) {
        throw new CliExecutionException("Could not get the URL for '" + classesFolder.getAbsolutePath() + "'.",
                e);
    }

    for (File file : FileUtils.listFiles(libFolder, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)) {
        try {
            urls.add(file.toURI().toURL());

        } catch (final MalformedURLException e) {
            throw new CliExecutionException("Could not get the URL for '" + file.getAbsolutePath() + "'.", e);
        }
    }

    return urls;
}

From source file:com.alibaba.citrus.maven.eclipse.base.eclipse.RemoveCacheMojo.java

/**
 * A list of all the not available marker <code>File</code>s in the localRepository. If there are no marker files
 * then an empty list is returned./*from   ww w .  jav a  2 s. c  om*/
 *
 * @return all the not available marker files in the localRepository or an empty list.
 */
private List/* <File> */ getNotAvailableMarkerFiles() {
    File localRepositoryBaseDirectory = new File(localRepository.getBasedir());
    List markerFiles = new ArrayList();

    Iterator iterator = FileUtils.iterateFiles(localRepositoryBaseDirectory,
            new SuffixFileFilter(IdeUtils.NOT_AVAILABLE_MARKER_FILE_SUFFIX), TrueFileFilter.INSTANCE);
    while (iterator.hasNext()) {
        File notAvailableMarkerFile = (File) iterator.next();
        markerFiles.add(notAvailableMarkerFile);
    }
    return markerFiles;
}

From source file:com.scaniatv.LangFileUpdater.java

/**
 * Method that gets a list of all lang files.
 * //from w  w  w . j av  a  2 s  . com
 * @return 
 */
public static String[] getLangFiles() {
    Collection<File> files = FileUtils.listFiles(new File(DEFAULT_LANG_ROOT), TrueFileFilter.INSTANCE,
            TrueFileFilter.INSTANCE);
    ArrayList<String> fileNames = new ArrayList<>();

    String sep = File.separator;

    files.forEach((File file) -> {
        fileNames.add(file.getPath().replace("." + sep + "scripts" + sep + "lang" + sep + "english" + sep, ""));
    });

    return fileNames.toArray(new String[fileNames.size()]);
}

From source file:com.autentia.poda.FilesCollection.java

private IOFileFilter andFiltersIgnoringTrueFilter(IOFileFilter filter1, IOFileFilter filter2) {
    if (filter1 == TrueFileFilter.INSTANCE)
        return filter2;
    if (filter2 == TrueFileFilter.INSTANCE)
        return filter1;
    return new AndFileFilter(filter1, filter2);
}

From source file:com.denimgroup.threadfix.framework.impl.dotNetWebForm.WebFormsEndpointGenerator.java

private List<AspxParser> getAspxParsers(File rootDirectory, Map<String, AscxFile> map,
        Map<String, AspxParser> masterFileMap) {
    Collection aspxFiles = FileUtils.listFiles(rootDirectory, new FileExtensionFileFilter("aspx"),
            TrueFileFilter.INSTANCE);

    List<AspxParser> aspxParsers = list();

    for (Object aspxFile : aspxFiles) {
        if (aspxFile instanceof File) {
            File file = (File) aspxFile;

            AspxParser aspxParser = AspxParser.parse(file);
            AspxUniqueIdParser uniqueIdParser = AspxUniqueIdParser.parse(file, map);

            if (masterFileMap.containsKey(uniqueIdParser.masterPage)) {
                aspxParser.parameters.addAll(masterFileMap.get(uniqueIdParser.masterPage).parameters);
            }//from www .j  av a 2s .c  o m

            aspxParser.parameters.addAll(uniqueIdParser.parameters);
            aspxParsers.add(aspxParser);
        }
    }
    return aspxParsers;
}

From source file:com.maxl.java.aips2sqlite.PseudoExpertInfo.java

public int process() {
    try {/* w w  w. j  a v a2s.co  m*/
        File dir = new File(FILE_PSEUDO_INFO_DIR);
        if (dir != null && dir.isDirectory()) {
            Collection<File> files = FileUtils.listFiles(dir, FileFilterUtils.suffixFileFilter(".docx"),
                    TrueFileFilter.INSTANCE);
            if (files != null) {
                System.out.println("\nProcessing total of " + files.size() + " pseudo Fachinfos...");
                int idxPseudo = 1;
                for (File pseudo : files) {
                    if (pseudo.isFile()) {
                        FileInputStream pseudoInfoFile = new FileInputStream(pseudo.getAbsoluteFile());
                        if (extractInfo(idxPseudo, pseudoInfoFile))
                            idxPseudo++;
                    }
                }
                return idxPseudo - 1;
            }
        } else {
            System.out.println("Directory with pseudo FIs not found!");
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        return 0;
    }
    return 0;
}

From source file:melnorme.utilbox.misc.FileUtil.java

protected static void deleteDirContents(final File directory, final boolean deleteDirectory)
        throws IOException {
    if (!directory.exists()) {
        return;/*  www  . ja  va 2  s  .  c  om*/
    }

    for (File currentFile : FileUtils.listFilesAndDirs(directory, TrueFileFilter.INSTANCE, null)) {
        if (!currentFile.exists()) {
            continue;
        }

        if (currentFile.isDirectory()) {
            FileUtils.deleteDirectory(currentFile);
        } else {
            currentFile.delete();
        }
    }
}

From source file:com.hurence.logisland.processor.DetectOutliersTest.java

@Test
@Ignore("too long")
public void testDetection() throws IOException {
    final TestRunner testRunner = TestRunners.newTestRunner(new DetectOutliers());
    testRunner.setProperty(DetectOutliers.ROTATION_POLICY_TYPE, "by_amount");
    testRunner.setProperty(DetectOutliers.ROTATION_POLICY_AMOUNT, "100");
    testRunner.setProperty(DetectOutliers.ROTATION_POLICY_UNIT, "points");
    testRunner.setProperty(DetectOutliers.CHUNKING_POLICY_TYPE, "by_amount");
    testRunner.setProperty(DetectOutliers.CHUNKING_POLICY_AMOUNT, "10");
    testRunner.setProperty(DetectOutliers.CHUNKING_POLICY_UNIT, "points");
    testRunner.setProperty(DetectOutliers.GLOBAL_STATISTICS_MIN, "-100000");
    testRunner.setProperty(DetectOutliers.MIN_AMOUNT_TO_PREDICT, "100");
    testRunner.setProperty(DetectOutliers.ZSCORE_CUTOFFS_NORMAL, "3.5");
    testRunner.setProperty(DetectOutliers.ZSCORE_CUTOFFS_MODERATE, "5");

    testRunner.setProperty(DetectOutliers.RECORD_VALUE_FIELD, "value");
    testRunner.setProperty(DetectOutliers.RECORD_TIME_FIELD, "timestamp");
    testRunner.assertValid();/*from   w  ww . jav a2 s .  co m*/

    File f = new File(RESOURCES_DIRECTORY);

    Pair<Integer, Integer>[] results = new Pair[] { new Pair(4032, 124), new Pair(4032, 8), new Pair(4032, 315),
            new Pair(4032, 0), new Pair(4032, 29), new Pair(4032, 2442), new Pair(4032, 314),
            new Pair(4032, 296)

    };

    int count = 0;
    for (File file : FileUtils.listFiles(f, new SuffixFileFilter(".csv"), TrueFileFilter.INSTANCE)) {

        if (count >= results.length)
            break;

        BufferedReader reader = Files.newBufferedReader(file.toPath(), ENCODING);
        List<Record> records = TimeSeriesCsvLoader.load(reader, true, inputDateFormat);
        Assert.assertTrue(!records.isEmpty());

        testRunner.clearQueues();
        testRunner.enqueue(records.toArray(new Record[records.size()]));
        testRunner.run();
        testRunner.assertAllInputRecordsProcessed();

        System.out.println("records.size() = " + records.size());
        System.out.println("testRunner.getOutputRecords().size() = " + testRunner.getOutputRecords().size());
        testRunner.assertOutputRecordsCount(results[count].getSecond());
        count++;

    }

}

From source file:bioLockJ.module.classifier.r16s.qiime.ClosedRefClassifier.java

/**
 * Directory top level holds only fasta files and it's subdirectory holds the corrected
 * QIIME specific mapping file as output by QiimePreprocessor.java
 *
 *//*  w ww . j a  va2s  . c om*/
@Override
protected void initInputFiles(File dir) throws Exception {
    if (dir == null) {
        dir = getInputDirsFromPropFile().get(0);
    }

    setModuleInput(dir, TrueFileFilter.INSTANCE, null);
    initMappingFile(dir);
}

From source file:net.semanticmetadata.lire.utils.FileUtils.java

/**
 * Returns all images from a directory in an array. Image files are identified by their suffix being from {.png, .jpg, .jpeg, .gif} in case insensitive manner.
 *
 * @param directory                 the directory to start with
 * @param descendIntoSubDirectories should we include sub directories?
 * @return an ArrayList<String> containing all the files or null if none are found..
 * @throws IOException/*w  w w . j  av  a 2 s.c o  m*/
 */
public static ArrayList<String> getAllImages(File directory, boolean descendIntoSubDirectories)
        throws IOException {
    ArrayList<String> resultList = new ArrayList<String>(256);
    IOFileFilter includeSubdirectories = TrueFileFilter.INSTANCE;
    if (!descendIntoSubDirectories)
        includeSubdirectories = null;
    Iterator<File> fileIterator = org.apache.commons.io.FileUtils.iterateFiles(directory, fileFilter,
            includeSubdirectories);
    while (fileIterator.hasNext()) {
        File next = fileIterator.next();
        resultList.add(next.getCanonicalPath());
    }
    if (resultList.size() > 0)
        return resultList;
    else
        return null;
}