List of usage examples for org.apache.commons.io.filefilter IOFileFilter IOFileFilter
IOFileFilter
From source file:com.websqrd.catbot.setting.CatbotSettings.java
public static List<DataHandlerConfig> getDataHandlerConfigList(boolean reload) { if (reload || dataHandlerConfigList.isEmpty()) { dataHandlerConfigList.clear();//from w w w . j a va 2 s .com String dirFile = HOME + "conf"; Collection list = FileUtils.listFiles(new File(dirFile), new IOFileFilter() { public boolean accept(File dir, String name) { if (name.startsWith("handler_")) { return true; } return false; } public boolean accept(File file) { if (file.getName().startsWith("handler_")) { return true; } return false; } }, null); Iterator iter = list.iterator(); while (iter.hasNext()) { File file = (File) iter.next(); String fileName = file.getName(); int s = fileName.indexOf('_'); int e = fileName.indexOf('.'); String handlerName = fileName.substring(s + 1, e); try { dataHandlerConfigList.add(getDataHandlerConfig(handlerName, true)); } catch (Exception e1) { e1.printStackTrace(); logger.error("?? ?? ? ??. {}", handlerName); } } } return dataHandlerConfigList; }
From source file:com.taobao.android.tools.TPatchTool.java
public void doBundleResPatch(String bundleName, File destPatchBundleDir, File newBundleUnzipFolder, File baseBundleUnzipFolder) throws IOException { // compare resource changes Collection<File> newBundleResFiles = FileUtils.listFiles(newBundleUnzipFolder, new IOFileFilter() { @Override// www .ja v a 2s .c o m public boolean accept(File file) { // ?dex if (file.getName().endsWith(".dex")) { return false; } String relativePath = PathUtils.toRelative(newBundleUnzipFolder, file.getAbsolutePath()); if (null != ((TpatchInput) (input)).notIncludeFiles && pathMatcher.match(((TpatchInput) (input)).notIncludeFiles, relativePath)) { return false; } return true; } @Override public boolean accept(File file, String s) { return accept(new File(file, s)); } }, TrueFileFilter.INSTANCE); for (File newBundleResFile : newBundleResFiles) { String resPath = PathUtils.toRelative(newBundleUnzipFolder, newBundleResFile.getAbsolutePath()); File baseBundleResFile = new File(baseBundleUnzipFolder, resPath); File destResFile = new File(destPatchBundleDir, resPath); if (baseBundleResFile.exists()) { if (isFileModify(newBundleResFile, baseBundleResFile, bundleName, resPath)) { // modify resource if (baseBundleResFile.getName().endsWith(".so")) { if (((TpatchInput) input).diffNativeSo && ((TpatchInput) input).diffBundleSo) { destResFile = new File(destPatchBundleDir, resPath.concat(".patch")); SoDiffUtils.diffSo(baseBundleResFile.getParentFile(), baseBundleResFile, newBundleResFile, destResFile); } else { FileUtils.copyFile(newBundleResFile, destResFile); } } else { FileUtils.copyFile(newBundleResFile, destResFile); } } } else {// new resource FileUtils.copyFile(newBundleResFile, destResFile); } } }
From source file:com.taobao.android.TPatchTool.java
/** * ?bundlepatch/*from w ww .j a va2 s . c o m*/ * * @param newBundleFile * @param baseBundleFile * @param patchTmpDir * @param diffTxtFile */ private void processBundleFiles(File newBundleFile, File baseBundleFile, File patchTmpDir) throws IOException, RecognitionException, PatchException { String bundleName = FilenameUtils.getBaseName(newBundleFile.getName()); File destPatchBundleDir = new File(patchTmpDir, bundleName); final File newBundleUnzipFolder = new File(newBundleFile.getParentFile(), bundleName); final File baseBundleUnzipFolder = new File(baseBundleFile.getParentFile(), bundleName); if (null != baseBundleFile && baseBundleFile.isFile() && baseBundleFile.exists() && !noPatchBundles.contains(baseBundleFile .getName().replace("_", ".").substring(3, baseBundleFile.getName().length() - 3)) && diffBundleDex) { // // dex ZipUtils.unzip(newBundleFile, newBundleUnzipFolder.getAbsolutePath()); ZipUtils.unzip(baseBundleFile, baseBundleUnzipFolder.getAbsolutePath()); File destDex = new File(destPatchBundleDir, DEX_NAME); File tmpDexFolder = new File(patchTmpDir, bundleName + "-dex"); createBundleDexPatch(newBundleUnzipFolder, baseBundleUnzipFolder, destDex, tmpDexFolder, false); // ? Collection<File> newBundleResFiles = FileUtils.listFiles(newBundleUnzipFolder, new IOFileFilter() { @Override public boolean accept(File file) { // ?dex if (file.getName().endsWith(".dex")) { return false; } String relativePath = PathUtils.toRelative(newBundleUnzipFolder, file.getAbsolutePath()); if (null != notIncludeFiles && pathMatcher.match(notIncludeFiles, relativePath)) { return false; } return true; } @Override public boolean accept(File file, String s) { return accept(new File(file, s)); } }, TrueFileFilter.INSTANCE); for (File newBundleResFile : newBundleResFiles) { String resPath = PathUtils.toRelative(newBundleUnzipFolder, newBundleResFile.getAbsolutePath()); File baseBundleResFile = new File(baseBundleUnzipFolder, resPath); File destResFile = new File(destPatchBundleDir, resPath); if (baseBundleResFile.exists()) { if (isFileModify(newBundleResFile, baseBundleResFile, bundleName, resPath)) { // ? FileUtils.copyFile(newBundleResFile, destResFile); } } else {// ? FileUtils.copyFile(newBundleResFile, destResFile); } } } else { // bundle? FileUtils.copyFileToDirectory(newBundleFile, patchTmpDir); } if (!isModifyBundle(newBundleFile.getName()) && !createAll) { FileUtils.deleteDirectory(destPatchBundleDir); Iterator<BundleDiffResult> iterator = patchInfos.iterator(); while (iterator.hasNext()) { BundleDiffResult bundleDiffResult = iterator.next(); if (bundleDiffResult.getBundleName().equals(bundleName.substring(3).replace("_", "."))) { iterator.remove(); } } } }
From source file:com.taobao.android.TPatchTool.java
/** * ?bundle??//from w ww .ja v a 2 s. c o m * * @param newApkUnzipFolder * @param baseApkUnzipFolder * @param patchTmpDir * @throws IOException */ private void copyMainBundleResources(final File newApkUnzipFolder, final File baseApkUnzipFolder, File patchTmpDir) throws IOException { boolean resoureModified = false; Collection<File> retainFiles = FileUtils.listFiles(newApkUnzipFolder, new IOFileFilter() { @Override public boolean accept(File file) { String relativePath = PathUtils.toRelative(newApkUnzipFolder, file.getAbsolutePath()); if (pathMatcher.match(DEFAULT_NOT_INCLUDE_RESOURCES, relativePath)) { return false; } if (null != notIncludeFiles && pathMatcher.match(notIncludeFiles, relativePath)) { return false; } return true; } @Override public boolean accept(File file, String s) { return accept(new File(file, s)); } }, TrueFileFilter.INSTANCE); for (File retainFile : retainFiles) { String relativePath = PathUtils.toRelative(newApkUnzipFolder, retainFile.getAbsolutePath()); File baseFile = new File(baseApkUnzipFolder, relativePath); if (isFileModify(retainFile, baseFile)) { resoureModified = true; File destFile = new File(patchTmpDir, relativePath); FileUtils.copyFile(retainFile, destFile); } } if (resoureModified) { File AndroidMenifestFile = new File(newApkUnzipFolder, ANDROID_MANIFEST); FileUtils.copyFileToDirectory(AndroidMenifestFile, patchTmpDir); } }
From source file:com.kdmanalytics.toif.assimilator.Assimilator.java
/** * get all the files from the argument list. * //w w w . j a v a 2 s.co m * @param args * the arguments handed to main. * @return the list of files in the argument array with the given extension. * @throws ToifException */ List<File> getFiles(String[] args, final String... extensions) throws ToifException { checkNotNull(args); checkNotNull(extensions); // set up a file filter. IOFileFilter fileFilter = new IOFileFilter() { @Override public boolean accept(File arg0) { for (String extension : extensions) { if (arg0.getName().endsWith(extension)) { return true; } } return false; } @Override public boolean accept(File arg0, String arg1) { for (String extension : extensions) { if (arg1.endsWith(extension)) { return true; } } return false; } }; // the files of the specific extension final List<File> files = new ArrayList<File>(); // int startIndex = 2; // for (String string : args) // { // if ("-p".equals(string)) // { // startIndex = 4; // } // } // starting at the unparsed options, ie the files in the arguments. for (int i = 2; i < args.length; i++) { if ("-p".equals(args[i])) { i = i += 2; } final String path = args[i]; final File file = new File(path); // if the file does not exist, bail. if (!file.exists()) { final String msg = "File does not exist: " + file.getName(); LOG.error(msg); throw new ToifException(msg); } if (file.isDirectory()) { files.addAll(FileUtils.listFiles(file, fileFilter, TrueFileFilter.INSTANCE)); } else { /* * only add the file to the results list if the file has the extension and is a file. */ for (String extension : extensions) { if (file.getAbsolutePath().endsWith(extension)) { files.add(file); Assimilator.debug(LOG, file.getName() + " added to the " + extension + " list"); } } } } if (debug) { for (File file : files) { System.err.println(file.getName()); } } // return the list of files. return files; }
From source file:com.taobao.android.tools.TPatchTool.java
@Override public PatchFile doPatch() throws Exception { TpatchInput tpatchInput = (TpatchInput) input; TpatchFile tpatchFile = new TpatchFile(); File hisPatchJsonFile = new File(tpatchInput.outPutJson.getParentFile(), "patchs-" + input.newApkBo.getVersionName() + ".json"); hisTpatchFolder = new File( tpatchInput.outPatchDir.getParentFile().getParentFile().getParentFile().getParentFile(), "hisTpatch"); tpatchFile.diffJson = new File(((TpatchInput) input).outPatchDir, "diff.json"); tpatchFile.patchInfo = new File(((TpatchInput) input).outPatchDir, "patchInfo.json"); final File patchTmpDir = new File(((TpatchInput) input).outPatchDir, "tpatch-tmp"); final File mainDiffFolder = new File(patchTmpDir, ((TpatchInput) input).mainBundleName); patchTmpDir.mkdirs();/* ww w . j av a 2 s . c o m*/ FileUtils.cleanDirectory(patchTmpDir); mainDiffFolder.mkdirs(); File lastPatchFile = null; readWhiteList(((TpatchInput) input).bundleWhiteList); lastPatchFile = getLastPatchFile(input.baseApkBo.getVersionName(), ((TpatchInput) input).productName, ((TpatchInput) input).outPatchDir); PatchUtils.getTpatchClassDef(lastPatchFile, bundleClassMap); Profiler.release(); Profiler.enter("unzip apks"); // unzip apk File unzipFolder = unzipApk(((TpatchInput) input).outPatchDir); final File newApkUnzipFolder = new File(unzipFolder, NEW_APK_UNZIP_NAME); final File baseApkUnzipFolder = new File(unzipFolder, BASE_APK_UNZIP_NAME); Profiler.release(); ExecutorServicesHelper executorServicesHelper = new ExecutorServicesHelper(); String taskName = "diffBundleTask"; // Collection<File> soFiles = FileUtils.listFiles(newApkUnzipFolder, new String[] { "so" }, true); //process remote bumdle if ((((TpatchInput) input).splitDiffBundle != null)) { for (final Pair<BundleBO, BundleBO> bundle : ((TpatchInput) input).splitDiffBundle) { if (bundle.getFirst() == null || bundle.getSecond() == null) { logger.warning("remote bundle is not set to splitDiffBundles"); continue; } executorServicesHelper.submitTask(taskName, new Callable<Boolean>() { @Override public Boolean call() throws Exception { TPatchTool.this.processBundleFiles(bundle.getSecond().getBundleFile(), bundle.getFirst().getBundleFile(), patchTmpDir); return true; } }); } } Profiler.enter("awbspatch"); Collection<File> retainFiles = FileUtils.listFiles(newApkUnzipFolder, new IOFileFilter() { @Override public boolean accept(File file) { String relativePath = PathUtils.toRelative(newApkUnzipFolder, file.getAbsolutePath()); if (pathMatcher.match(DEFAULT_NOT_INCLUDE_RESOURCES, relativePath)) { return false; } if (null != ((TpatchInput) (input)).notIncludeFiles && pathMatcher.match(((TpatchInput) (input)).notIncludeFiles, relativePath)) { return false; } return true; } @Override public boolean accept(File file, String s) { return accept(new File(file, s)); } }, TrueFileFilter.INSTANCE); executorServicesHelper.submitTask(taskName, new Callable<Boolean>() { @Override public Boolean call() throws Exception { // bundledex diff // File mianDiffDestDex = new File(mainDiffFolder, DEX_NAME); // File tmpDexFolder = new File(patchTmpDir, ((TpatchInput)input).mainBundleName + "-dex"); createBundleDexPatch(newApkUnzipFolder, baseApkUnzipFolder, mainDiffFolder, // tmpDexFolder, true); // ??bundle? if (isRetainMainBundleRes()) { copyMainBundleResources(newApkUnzipFolder, baseApkUnzipFolder, new File(patchTmpDir, ((TpatchInput) input).mainBundleName), retainFiles); } return true; } }); for (final File soFile : soFiles) { System.out.println("do patch:" + soFile.getAbsolutePath()); final String relativePath = PathUtils.toRelative(newApkUnzipFolder, soFile.getAbsolutePath()); if (null != ((TpatchInput) input).notIncludeFiles && pathMatcher.match(((TpatchInput) input).notIncludeFiles, relativePath)) { continue; } executorServicesHelper.submitTask(taskName, new Callable<Boolean>() { @Override public Boolean call() throws Exception { File destFile = new File(patchTmpDir, ((TpatchInput) input).mainBundleName + "/" + relativePath); File baseSoFile = new File(baseApkUnzipFolder, relativePath); if (isBundleFile(soFile)) { processBundleFiles(soFile, baseSoFile, patchTmpDir); } else if (isFileModify(soFile, baseSoFile)) { if (destFile.exists()) { FileUtils.deleteQuietly(destFile); } if (!baseSoFile.exists() || !((TpatchInput) input).diffNativeSo) { // FileUtils.copyFile(soFile, destFile); } else { destFile = new File(destFile.getParentFile(), destFile.getName() + ".patch"); SoDiffUtils.diffSo(patchTmpDir, baseSoFile, soFile, destFile); soFileDefs.add(new SoFileDef(baseSoFile, soFile, destFile, relativePath)); } } return true; } }); } executorServicesHelper.waitTaskCompleted(taskName); executorServicesHelper.stop(); Profiler.release(); Profiler.enter("ziptpatchfile"); // zip file File patchFile = createTPatchFile(((TpatchInput) input).outPatchDir, patchTmpDir); tpatchFile.patchFile = patchFile; PatchInfo curPatchInfo = createBasePatchInfo(patchFile); Profiler.release(); Profiler.enter("createhistpatch"); BuildPatchInfos buildPatchInfos = createIncrementPatchFiles(((TpatchInput) input).productName, patchFile, ((TpatchInput) input).outPatchDir, newApkUnzipFolder, curPatchInfo, ((TpatchInput) input).hisPatchUrl); Profiler.release(); Profiler.enter("writejson"); buildPatchInfos.getPatches().add(curPatchInfo); buildPatchInfos.setBaseVersion(input.baseApkBo.getVersionName()); buildPatchInfos.setDiffBundleDex(input.diffBundleDex); FileUtils.writeStringToFile(((TpatchInput) input).outPutJson, JSON.toJSONString(buildPatchInfos)); BuildPatchInfos testForBuildPatchInfos = new BuildPatchInfos(); testForBuildPatchInfos.setBaseVersion(buildPatchInfos.getBaseVersion()); List<PatchInfo> patchInfos = new ArrayList<>(); testForBuildPatchInfos.setPatches(patchInfos); testForBuildPatchInfos.setDiffBundleDex(buildPatchInfos.isDiffBundleDex()); for (PatchInfo patchInfo : buildPatchInfos.getPatches()) { if (patchInfo.getTargetVersion().equals(buildPatchInfos.getBaseVersion())) { patchInfos.add(patchInfo); } } FileUtils.writeStringToFile(hisPatchJsonFile, JSON.toJSONString(testForBuildPatchInfos)); tpatchFile.updateJsons = new ArrayList<File>(); Map<String, List<String>> map = new HashMap<>(); for (PatchInfo patchInfo : buildPatchInfos.getPatches()) { UpdateInfo updateInfo = new UpdateInfo(patchInfo, buildPatchInfos.getBaseVersion()); // System.out.println("start to check:"+patchInfo.getTargetVersion()+"......"); // List<PatchChecker.ReasonMsg> msgs = new PatchChecker(updateInfo,bundleInfos.get(patchInfo.getTargetVersion()),new File(((TpatchInput) input).outPatchDir,patchInfo.getFileName())).check(); // map.put(patchInfo.getFileName(),msgToString(msgs)); File updateJson = new File(((TpatchInput) input).outPatchDir, "update-" + patchInfo.getTargetVersion() + ".json"); FileUtils.writeStringToFile(updateJson, JSON.toJSONString(updateInfo, true)); tpatchFile.updateJsons.add(updateJson); } // tpatchFile.patchChecker = new File(((TpatchInput) input).outPatchDir,"patch-check.json"); // FileUtils.writeStringToFile(tpatchFile.patchChecker, JSON.toJSONString(map, true)); // FileUtils.deleteDirectory(patchTmpDir); apkDiff.setBaseApkVersion(input.baseApkBo.getVersionName()); apkDiff.setNewApkVersion(input.newApkBo.getVersionName()); apkDiff.setBundleDiffResults(bundleDiffResults); boolean newApkFileExist = input.newApkBo.getApkFile().exists() && input.newApkBo.getApkFile().isFile(); if (newApkFileExist) { apkDiff.setNewApkMd5(MD5Util.getFileMD5String(input.newApkBo.getApkFile())); } apkDiff.setFileName(input.newApkBo.getApkName()); apkPatchInfos.setBaseApkVersion(input.baseApkBo.getVersionName()); apkPatchInfos.setNewApkVersion(input.newApkBo.getVersionName()); apkPatchInfos.setBundleDiffResults(diffPatchInfos); apkPatchInfos.setFileName(patchFile.getName()); apkPatchInfos.setNewApkMd5(MD5Util.getFileMD5String(patchFile)); FileUtils.writeStringToFile(tpatchFile.diffJson, JSON.toJSONString(apkDiff)); FileUtils.writeStringToFile(tpatchFile.patchInfo, JSON.toJSONString(apkPatchInfos)); FileUtils.copyFileToDirectory(tpatchFile.diffJson, ((TpatchInput) input).outPatchDir.getParentFile(), true); if (newApkFileExist) { FileUtils.copyFileToDirectory(input.newApkBo.getApkFile(), ((TpatchInput) input).outPatchDir.getParentFile(), true); } Profiler.release(); logger.warning(Profiler.dump()); return tpatchFile; }
From source file:com.photon.phresco.framework.impl.SCMManagerImpl.java
public void perforceSync(RepoDetail repodetail, String baseDir, String projectName, String flag) throws ConnectionException, RequestException { String url = repodetail.getRepoUrl(); String userName = repodetail.getUserName(); String password = repodetail.getPassword(); String stream = repodetail.getStream(); try {/*from www . j a v a 2 s . c o m*/ IOptionsServer server = ServerFactory.getOptionsServer("p4java://" + url, null, null); server.connect(); server.setUserName(userName); if (password != "") { server.login(password); } IClient client = new Client(); client.setName(projectName); if (flag.equals("update")) { String[] rootArr = baseDir.split(projectName); String root = rootArr[0].substring(0, rootArr[0].length() - 1); client.setRoot(root); } else { client.setRoot(baseDir); } client.setServer(server); server.setCurrentClient(client); ClientViewMapping tempMappingEntry = new ClientViewMapping(); tempMappingEntry.setLeft(stream + "/..."); tempMappingEntry.setRight("//" + projectName + "/..."); ClientView clientView = new ClientView(); clientView.addEntry(tempMappingEntry); try { String[] arr = repodetail.getStream().split("//"); String[] arr1 = arr[1].split("/"); client.setStream("//" + arr1[0] + "/" + arr1[1]); client.setClientView(clientView); client.setOptions(new ClientOptions("noallwrite clobber nocompress unlocked nomodtime normdir")); } catch (ArrayIndexOutOfBoundsException e) { throw new RequestException(); } if (client != null) { List<IFileSpec> syncList = client.sync(FileSpecBuilder.makeFileSpecList(stream + "/..."), new SyncOptions()); for (IFileSpec fileSpec : syncList) { if (fileSpec != null) { if (fileSpec.getOpStatus() == FileSpecOpStatus.VALID) { } else { System.err.println(fileSpec.getStatusMessage()); } } } } IOFileFilter filter = new IOFileFilter() { @Override public boolean accept(File arg0, String arg1) { return true; } @Override public boolean accept(File arg0) { return true; } }; Iterator<File> iterator = FileUtils.iterateFiles(new File(baseDir), filter, filter); while (iterator.hasNext()) { File file = iterator.next(); file.setWritable(true); } } catch (RequestException rexc) { System.err.println(rexc.getDisplayString()); rexc.printStackTrace(); throw new RequestException(); } catch (P4JavaException jexc) { System.err.println(jexc.getLocalizedMessage()); jexc.printStackTrace(); throw new ConnectionException(); } catch (Exception exc) { System.err.println(exc.getLocalizedMessage()); exc.printStackTrace(); } }
From source file:org.ala.repository.Validator.java
/** * File system crawler - looks for files of interest and triggers * validator methods.//from www. j a v a 2 s . c o m * * @throws Exception */ public void findAndValidateFiles() throws Exception { IOFileFilter fileFilter = new IOFileFilter() { // AIC implementation of interface @Override public boolean accept(File file) { validateFile(file); return false; } @Override public boolean accept(File dir, String name) { return true; } }; IOFileFilter dirFilter = new IOFileFilter() { // AIC implementation of interface @Override public boolean accept(File file) { //logger.debug("isId = "+infoSourceId+"|dir = "+file.getParent()+"|name = "+file.getName()+ // "|"+rootDirectory+File.separator+infoSourceId+File.separator); if (infoSourceId != null && (rootDirectory.equals(file.getParent()) && file.getName().equals(infoSourceId.toString()))) { logger.info("Crawling dir: " + file.getAbsolutePath()); return true; } else if (infoSourceId != null && file.getParent().startsWith(rootDirectory + File.separator + infoSourceId)) { logger.debug("crawling..."); return true; } else if (infoSourceId != null) { return false; } else { return true; } } @Override public boolean accept(File dir, String name) { return true; } }; logger.info("Validating repository files..."); FileUtils.listFiles(new File(rootDirectory), fileFilter, dirFilter); logger.info("Validating completed."); }
From source file:org.apache.flume.source.syncdir.SyncDirFileLineReader.java
/** * Find the next file in the directory by walking through directory tree. * * @return the next file// w w w .ja v a2s. com */ private Optional<ResettableFileLineReader> getNextFile() { if (null != filesIterator && !filesIterator.hasNext()) { filesIterator = null; return Optional.absent(); } if (null == filesIterator) { filesIterator = FileUtils.iterateFiles(directory, new IOFileFilter() { @Override public boolean accept(File file) { if (!file.exists()) return false; // skip non-exist files in iterator if (file.isFile()) { String fileStr = file.getName(); if (!(fileStr.endsWith(endFileSuffix) || fileStr.endsWith(statsFileSuffix) || fileStr.endsWith(finishedStatsFileSuffix))) { File finishedMarkFile = new File(file.getPath() + finishedStatsFileSuffix); if (!finishedMarkFile.exists()) return true; } } return false; } @Override public boolean accept(File dir, String name) { return false; } }, TrueFileFilter.INSTANCE); } File nextFile; boolean fileEnded; if (!filesIterator.hasNext()) return Optional.absent(); /* checking file's reading progress, skip if needed */ nextFile = filesIterator.next(); logger.debug("treating next file: {}", nextFile); fileEnded = new File(nextFile.getPath() + endFileSuffix).exists(); if (fileEnded) { logger.debug("file {} marked as ended", nextFile); } try { ResettableFileLineReader file = new ResettableFileLineReader(nextFile, fileEnded, statsFilePrefix, statsFileSuffix, finishedStatsFileSuffix); return Optional.of(file); } catch (IOException e) { logger.error("Exception opening file: " + nextFile, e); return Optional.absent(); } }
From source file:org.apache.hadoop.gateway.util.ServiceDefinitionsLoader.java
private static Collection<File> getFileList(File servicesDir) { Collection<File> files; if (servicesDir.exists() && servicesDir.isDirectory()) { files = FileUtils.listFiles(servicesDir, new IOFileFilter() { @Override/*from w w w . ja v a 2 s .c om*/ public boolean accept(File file) { return file.getName().contains(SERVICE_FILE_NAME); } @Override public boolean accept(File dir, String name) { return name.contains(SERVICE_FILE_NAME); } }, TrueFileFilter.INSTANCE); } else { files = new HashSet<>(); } return files; }