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:channellistmaker.listmaker.fileseeker.FileSeeker.java

/**
 * ??true???????true//from w w w . j  a va  2  s  .  c o m
 *
 * @param recursive 
 */
public synchronized void setRecursive(boolean recursive) {
    if (recursive == false) {
        this.dirf = FalseFileFilter.INSTANCE;
    } else {
        this.dirf = TrueFileFilter.INSTANCE;
    }
}

From source file:com.magnet.tools.tests.FileSystemStepDefs.java

@Then("^the directory structure for \"([^\"]*)\" should not be:$")
public static void the_directory_should_not_be(String directory, List<String> entries) throws Throwable {
    the_directory_should_exist(directory);
    try {//from www.j  a va 2 s . co  m
        for (String entry : entries) {
            the_file_does_not_exist(directory + "/" + entry);
        }
    } catch (AssertionError e) {
        StringBuilder tree = new StringBuilder(
                "Entry found: " + e.getMessage() + "\nThe directory structure for " + directory + " was:\n");
        for (File f : FileUtils.listFilesAndDirs(new File(directory), TrueFileFilter.INSTANCE,
                TrueFileFilter.INSTANCE)) {
            tree.append(f).append("\n");
        }
        throw new AssertionError(tree.toString(), e);
    }
}

From source file:cloudExplorer.SyncToS3.java

public void run() {
    String[] extensions = new String[] { " " };
    List<File> files = (List<File>) FileUtils.listFiles(location, TrueFileFilter.INSTANCE,
            TrueFileFilter.INSTANCE);// w  w  w .j a  v a  2  s. co m
    for (File file_found : files) {
        int found = 0;

        if (mainFrame.jRadioButton1.isSelected()) {

        } else {

            for (int y = 1; y != objectarray.length; y++) {
                if (objectarray[y].contains(makeDirectory(file_found.getAbsolutePath().toString()))) {
                    //mainFrame.jTextArea1.append("\nObject already exists on S3: " + file_found);
                    calibrate();
                    found++;
                }
            }
        }

        if (found == 0) {

            String object = makeDirectory(file_found.getAbsolutePath().toString());
            String[] cut = object.split(file_found.getName());
            String[] cut2 = null;
            object = object.replace(cut[0], "");
            String win = "\\";
            String lin = "/";
            if (cut[0].contains(win)) {
                cut2 = cut[0].split(win);
                object = cut2[cut2.length - 1] + win + object;
            } else {
                cut2 = cut[0].split(lin);
                object = cut2[cut2.length - 1] + lin + object;
            }

            if (SyncToS3.running) {
                int index = mainFrame.jList3.getSelectedIndex(); //get selected index

                try {
                    if (index != -1) {
                        object = mainFrame.jList3.getSelectedValue().toString() + object;
                    }
                } catch (Exception indaex) {

                }
                put = new Put(file_found.getAbsolutePath().toString(), access_key, secret_key, bucket, endpoint,
                        object, rrs, encrypt);
                put.run();
            }
            found = 0;
        }
    }
    mainFrame.reloadBuckets();
    mainFrame.jTextArea1.append(
            "\nSync operation finished running. Please observe this window for any transfers that may still be running.");
    calibrate();
}

From source file:com.denimgroup.threadfix.framework.impl.dotNet.DotNetMappings.java

@SuppressWarnings("unchecked")
public DotNetMappings(@Nonnull File rootDirectory) {
    assert rootDirectory.exists() : "Root file did not exist.";
    assert rootDirectory.isDirectory() : "Root file was not a directory.";

    this.rootDirectory = rootDirectory;

    cSharpFiles = FileUtils.listFiles(rootDirectory, new FileExtensionFileFilter("cs"),
            TrueFileFilter.INSTANCE);

    generateMappings();/*from  w w w  .ja  va 2 s . c  om*/
}

From source file:localSPs.CubbyAPI.java

public double getStorageSize() throws IOException {
    BigInteger num = new BigInteger("1024");
    String ans = "";
    BigInteger totalMemory = new BigInteger("5368709120");
    BigInteger used;/*from   www  . j av  a2  s.c o  m*/
    File dir = new File(ROOT_PATH);
    long totalUsed = 0; // total bytes
    List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
    for (File file : files) {
        totalUsed += file.length();
    }
    used = new BigInteger(String.valueOf(totalUsed));
    ans = totalMemory.subtract(used).divide(num).divide(num).toString();//MB
    return (Double.parseDouble(ans));
}

From source file:localSPs.BearDataShareAPI.java

public double getStorageSize() throws IOException {
    BigInteger num = new BigInteger("1024");
    String ans = "";
    BigInteger totalMemory = new BigInteger("21474836480");
    BigInteger used;/*ww w  .j  a v a  2 s  .co m*/
    File dir = new File(ROOT_PATH);
    long totalUsed = 0; // total bytes
    List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
    for (File file : files) {
        totalUsed += file.length();
    }
    used = new BigInteger(String.valueOf(totalUsed));
    ans = totalMemory.subtract(used).divide(num).divide(num).toString();//MB
    return (Double.parseDouble(ans));
}

From source file:localSPs.SpiderOakAPI.java

public double getStorageSize() throws IOException {
    BigInteger num = new BigInteger("1024");
    String ans = "";
    BigInteger totalMemory = new BigInteger("32212254720");
    BigInteger used;/* ww w  .  j a v  a 2 s . c  o m*/
    File dir = new File(ROOT_PATH);
    long totalUsed = 0; // total bytes

    List<File> files = (List<File>) FileUtils.listFiles(dir, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE);
    for (File file : files) {
        totalUsed += file.length();
    }
    used = new BigInteger(String.valueOf(totalUsed));
    ans = totalMemory.subtract(used).divide(num).divide(num).toString();//MB
    return (Double.parseDouble(ans));
}

From source file:com.textocat.textokit.commons.util.CrossValidationCorpusSplitter.java

private void run() throws Exception {
    IOFileFilter corpusFileFilter;/*from ww  w  . j  a  va2s .com*/
    if (corpusFileSuffix == null) {
        corpusFileFilter = FileFilterUtils.trueFileFilter();
    } else {
        corpusFileFilter = FileFilterUtils.suffixFileFilter(corpusFileSuffix);
    }
    IOFileFilter corpusSubDirFilter = includeSubDirectores ? TrueFileFilter.INSTANCE : null;
    List<CorpusSplit> corpusSplits = CorpusUtils.createCrossValidationSplits(corpusDir, corpusFileFilter,
            corpusSubDirFilter, foldNum);
    for (int i = 0; i < corpusSplits.size(); i++) {
        writeFileLists(outputDir, i, corpusSplits.get(i));
    }
}

From source file:AIR.Common.Utilities.Path.java

public static Collection<File> getFilesMatchingExtensions(String folder, final String[] extensions) {
    return (Collection<File>) FileUtils.listFiles(new File(folder), new IOFileFilter() {
        @Override/*from   w w  w .  j  a  v  a2  s  .  c o m*/
        public boolean accept(File arg0) {
            return matches(arg0.getAbsolutePath());
        }

        @Override
        public boolean accept(File arg0, String arg1) {
            return matches(arg1);
        }

        private boolean matches(String file) {
            for (int counter1 = 0; counter1 < extensions.length; ++counter1) {
                if (StringUtils.endsWithIgnoreCase(file, extensions[counter1]))
                    return true;
            }
            return false;
        }

    }, TrueFileFilter.INSTANCE);
}

From source file:android.databinding.tool.util.GenerationalClassUtil.java

private static void loadFromDirectory(File directory) {
    for (File file : FileUtils.listFiles(directory, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE)) {
        for (ExtensionFilter filter : ExtensionFilter.values()) {
            if (filter.accept(file.getName())) {
                InputStream inputStream = null;
                try {
                    inputStream = FileUtils.openInputStream(file);
                    Serializable item = fromInputStream(inputStream);
                    if (item != null) {
                        //noinspection unchecked
                        sCache[filter.ordinal()].add(item);
                        L.d("loaded item %s from file", item);
                    }/*from  ww w  .ja v a2s .c o m*/
                } catch (IOException e) {
                    L.e(e, "Could not merge in Bindables from %s", file.getAbsolutePath());
                } catch (ClassNotFoundException e) {
                    L.e(e, "Could not read Binding properties intermediate file. %s", file.getAbsolutePath());
                } finally {
                    IOUtils.closeQuietly(inputStream);
                }
            }
        }
    }
}