List of usage examples for org.apache.commons.io.filefilter WildcardFileFilter WildcardFileFilter
public WildcardFileFilter(List wildcards, IOCase caseSensitivity)
From source file:com.tekstosense.opennlp.config.ModelLoaderConfig.java
/** * Gets the models.// w ww.j a v a 2 s . c om * * @return the models */ public static String[] getModels() { File dir = new File(Config.getConfiguration().getString(MODELPATH)); LOG.info("Loading Models from... " + dir.getAbsolutePath()); List<String> models = new ArrayList<>(); String[] modelNames = getModelNames(); List<String> wildCardPath = Arrays.stream(modelNames).map(model -> { return "en-ner-" + model + "*.bin"; }).collect(Collectors.toList()); FileFilter fileFilter = new WildcardFileFilter(wildCardPath, IOCase.INSENSITIVE); List<String> filePath = Arrays.asList(dir.listFiles(fileFilter)).stream() .map(file -> file.getAbsolutePath()).collect(Collectors.toList()); return filePath.toArray(new String[filePath.size()]); }
From source file:com.sangupta.andruil.utils.ArgumentUtils.java
/** * Resolve the supplied file argument which may contain wildcards * to a list of all valid files.//from w ww .j a v a 2 s .co m * * @param arg * @return */ public static File[] resolveFiles(final File currentDir, String arg) { if (arg == null) { return null; } if (!hasWildcards(arg)) { File file = new File(currentDir, arg); return new File[] { file }; } // the argument does have wild cards // resolve it FileFilter wildcardFileFilter = new WildcardFileFilter(arg, IOCase.SYSTEM); File[] files = currentDir.listFiles(wildcardFileFilter); return files; }
From source file:br.msf.maven.compressor.processor.CssCompressor.java
@Override public boolean accept(final File inputFile) { return IOUtils.isFile(inputFile) && (new WildcardFileFilter(CSS_WILDCARDS, IOCase.INSENSITIVE)).accept(inputFile); }
From source file:it.geosolutions.tools.io.CollectorTests.java
@Test public final void testCollect() throws Exception { Collector c = new Collector(FileFilterUtils.or(new WildcardFileFilter("*_PCK.xml", IOCase.INSENSITIVE), new WildcardFileFilter("*_PRO", IOCase.INSENSITIVE))); File location = TestData.file(this, "collector"); LOGGER.info("Location: " + location.getAbsoluteFile()); assertNotNull(location);//from w w w. j a va2 s . c om assertTrue(location.exists()); List<File> list = c.collect(location); assertNotNull(list); LOGGER.info("Number of files..." + list.size()); for (File f : list) { LOGGER.info("FILE: " + f.getAbsolutePath()); } assertEquals("Wrong number of files...", FILES_IN_TEST, list.size()); }
From source file:com.arcbees.gwtpolymer.fs.CopyPolymerFilter.java
public CopyPolymerFilter() { List<IOFileFilter> filters = new ArrayList<>(); filters.add(new WildcardFileFilter( new String[] { "*.html", "*.css", "*.js", "*.js.map", "src", "transitions" }, INSENSITIVE)); filters.add(new NotFileFilter(new WildcardFileFilter(NAMES_TO_IGNORE, INSENSITIVE))); delegate = new AndFileFilter(filters); }
From source file:br.msf.maven.compressor.processor.JavaScriptCompressor.java
@Override public boolean accept(final File inputFile) { return inputFile != null && inputFile.isFile() && (new WildcardFileFilter(JAVASCRIPT_WILDCARDS, IOCase.INSENSITIVE)).accept(inputFile); }
From source file:com.tekstosense.opennlp.config.ModelLoaderConfig.java
public static String[] getModels(String[] modelNames) { File dir = new File(Config.getConfiguration().getString(MODELPATH)); LOG.info("Loading Models from... " + dir.getAbsolutePath()); List<String> wildCardPath = Arrays.stream(modelNames).map(model -> { return "en-ner-" + model + "*.bin"; }).collect(Collectors.toList()); FileFilter fileFilter = new WildcardFileFilter(wildCardPath, IOCase.INSENSITIVE); List<String> filePath = Arrays.asList(dir.listFiles(fileFilter)).stream() .map(file -> file.getAbsolutePath()).collect(Collectors.toList()); return filePath.toArray(new String[filePath.size()]); }
From source file:com.arcbees.gwtpolymer.tasks.ComponentFilesCollector.java
private File[] getHtmlFiles(File componentPublicDirectory) { return componentPublicDirectory.listFiles((FileFilter) new WildcardFileFilter("*.html", INSENSITIVE)); }
From source file:com.arcbees.gwtpolymer.tasks.ComponentFilesCollector.java
private File[] getJsFiles(File componentPublicDirectory) { return componentPublicDirectory.listFiles((FileFilter) new WildcardFileFilter("*.js", INSENSITIVE)); }
From source file:com.tekstosense.opennlp.config.ModelLoaderConfig.java
/** * Gets the models. This method is used if ModelPath is passed as parameter. * /*from w w w. j av a 2 s . c o m*/ * * @return the models */ public static String[] getModels(String modelDirectory) { File dir = new File(modelDirectory); LOG.info("Loading Models from... " + dir.getAbsolutePath()); List<String> models = new ArrayList<>(); String[] modelNames = getModelNames(); List<String> wildCardPath = Arrays.stream(modelNames).map(model -> { return "en-ner-" + model + "*.bin"; }).collect(Collectors.toList()); FileFilter fileFilter = new WildcardFileFilter(wildCardPath, IOCase.INSENSITIVE); List<String> filePath = Arrays.asList(dir.listFiles(fileFilter)).stream() .map(file -> file.getAbsolutePath()).collect(Collectors.toList()); return filePath.toArray(new String[filePath.size()]); }