public static FindFile create() { return new FindFile(); }
/** * Clears all settings and removes all created bundle files from file system. */ public synchronized void reset() { if (strategy == Strategy.ACTION_MANAGED) { actionBundles.clear(); mirrors.clear(); } FindFile ff = new FindFile(); ff.includeDirs(false); ff.searchPath(new File(bundleFolder, staplerPath)); File f; int count = 0; while ((f = ff.nextFile()) != null) { f.delete(); count++; } if (log.isInfoEnabled()) { log.info("reset: " + count + " bundle files deleted."); } }
/** * Scans single classpath directory. * @see #onEntry(EntryData) */ protected void scanClassPath(File root) { String rootPath = root.getAbsolutePath(); if (!rootPath.endsWith(File.separator)) { rootPath += File.separatorChar; } FindFile ff = new FindFile().setIncludeDirs(false).setRecursive(true).searchPath(rootPath); File file; while ((file = ff.nextFile()) != null) { String filePath = file.getAbsolutePath(); try { if (StringUtil.endsWithIgnoreCase(filePath, CLASS_FILE_EXT)) { scanClassFile(filePath, rootPath, file, true); } else if (includeResources) { scanClassFile(filePath, rootPath, file, false); } } catch (RuntimeException rex) { if (!ignoreException) { throw rex; } } } }
@Test void testJustFoldersAndFiles() { FindFile ff = new FindFile(); ff.includeDirs(false); ff.includeFiles(true); ff.recursive(false); ff.sortByName(); ff.searchPath(dataRoot); File f; StringBuilder str = new StringBuilder(); while ((f = ff.nextFile()) != null) { str.append(f.getName()).append(" | "); } assertEquals("alpha.txt | jodd1.txt | jodd10.txt | zero.txt | ", str.toString()); ff = new FindFile(); ff.includeDirs(true); ff.includeFiles(false); ff.recursive(false); ff.sortByName(); ff.searchPath(dataRoot); str = new StringBuilder(); while ((f = ff.nextFile()) != null) { str.append(f.getName()).append(" | "); } assertEquals("beta | sumo | ", str.toString()); }
final StringBuilder str = new StringBuilder(); FindFile ff = new FindFile(); ff.includeDirs(true); ff.includeFiles(true);
@Test void testNonExisting() { FindFile wff = new FindFile(); wff.includeDirs(true); wff.includeFiles(true); wff.recursive(true); wff.walking(true); wff.searchPath(dataRoot + "/void"); wff.matchType(WildcardFindFile.Match.FULL_PATH); int count = 0; while (wff.nextFile() != null) { count++; } assertEquals(0, count); }
public static FindFile create() { return new FindFile(); }
/** * Clears all settings and removes all created bundle files from file system. */ public synchronized void reset() { if (strategy == Strategy.ACTION_MANAGED) { actionBundles.clear(); mirrors.clear(); } FindFile ff = new FindFile(); ff.setIncludeDirs(false); ff.searchPath(new File(bundleFolder, staplerPath)); File f; int count = 0; while ((f = ff.nextFile()) != null) { f.delete(); count++; } if (log.isInfoEnabled()) { log.info("reset: " + count + " bundle files deleted."); } }
/** * Clears all settings and removes all created bundle files from file system. */ public synchronized void reset() { if (strategy == Strategy.ACTION_MANAGED) { actionBundles.clear(); mirrors.clear(); } FindFile ff = new FindFile(); ff.includeDirs(false); ff.searchPath(new File(bundleFolder, staplerPath)); File f; int count = 0; while ((f = ff.nextFile()) != null) { f.delete(); count++; } if (log.isInfoEnabled()) { log.info("reset: " + count + " bundle files deleted."); } }