List of utility methods to do File Find
File | find(final File root, final String name) find if (root.getName().equals(name)) { return root; if (root.isDirectory()) { for (final File child : root.listFiles()) { final File result = find(child, name); if (result != null) { return result; ... |
String | find(String _sSourceString, String _sReg, int group) find return find(_sSourceString, _sReg, group, "GBK", "GBK"); |
File | find(String executable, File... dirs) Tries to find an executable with the given name. if (dirs != null) { for (File hint : dirs) { File file = findExecutableInDirectory(executable, hint); if (file != null) { return file; return findExecutableInSystemPath(executable); |
File | find(String name, File dir) Find a file in an extracted OAR directory File found = null; File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { found = find(name, file); if (found != null) break; ... |
List | find(String path, String matcher) find List<File> files = new ArrayList<File>(); File root = new File(path); File[] list = root.listFiles(); if (list == null) return files; for (File file : list) { if (file.getName().matches(matcher)) { files.add(file); ... |
boolean | find(String path, String suffix) find File[] files = (new File(path)).listFiles(); for (File file : files) { if (file.isDirectory()) return find(file.getAbsolutePath(), suffix); else if (file.getName().endsWith(suffix)) return true; return false; ... |
void | find2(File baseDir, FileFilter filter, List find assert baseDir != null && filter != null && files != null; for (File f : baseDir.listFiles()) { if (f.equals(baseDir)) { continue; if (!includeHiddenFiles && f.isHidden()) { continue; assert includeHiddenFiles || !f.getName().startsWith(".") : f; if (filter.accept(f)) { if (f.exists()) { files.add(f); } else { if (f.isDirectory()) { find2(f, filter, files, includeHiddenFiles); |
File[] | findByExt(File base, String ext) find By Ext Vector result = new Vector(); findByExtWorker(result, base, ext); Object objs[] = result.toArray(); File files[] = new File[objs.length]; System.arraycopy(objs, 0, files, 0, objs.length); return files; |
List | findByExtension(final File directory, final String extension) Find the files with an extension inside a directory. assert directory.isDirectory(); File[] res = directory.listFiles(fileName -> fileName.getName().endsWith(extension)); if (res == null) { return Collections.emptyList(); return Arrays.asList(res); |
File | findByFileName(List find By File Name for (File itFile : files) { if (itFile.getName().equals(fileName)) { return itFile; throw new FileNotFoundException("The file name " + fileName + " doesn't exist"); |