Package java.io

Examples of java.io.FileFilter


      }     
    }
  }
 
  private static List<File> listFiles(File dir) {
    List<File> files = Lists.newArrayList(dir.listFiles(new FileFilter
        () {
      @Override
      public boolean accept(File pathname) {
        return !pathname.isDirectory();
      }
View Full Code Here


    while (dir != null && dir.isDirectory()) {
      File testFile = new File(dir, "flume-ng-dist/target");

      if (testFile.exists() && testFile.isDirectory()) {
        LOGGER.info("Found candidate dir: " + testFile.getCanonicalPath());
        File[] candidateFiles = testFile.listFiles(new FileFilter() {

          @Override
          public boolean accept(File pathname) {
            String name = pathname.getName();
            if (name != null && name.startsWith("apache-flume-")
View Full Code Here

        File dir = new File(packagePath);
        if (!dir.exists() || !dir.isDirectory()) {
            return;
        }
        final boolean fileRecursive = recursive;
        File[] dirfiles = dir.listFiles(new FileFilter() {
            // 自定义文件过滤规则
            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return fileRecursive;
                }
View Full Code Here

     * end in the specified suffix
     *
     * @throws IllegalArgumentException if {@code baseDir} is not a directory
     */
    public DirectoryWalker(File baseDir, final String suffix) {
        this(baseDir, new FileFilter() {
                public boolean accept(File f) {
                    return f.getName().endsWith(suffix);
                }
            });
    }
View Full Code Here

                "it.wallgren.android.platform.classpathContainerInitializer"
                        + repoPath.makeAbsolute()));
    }

    private IClasspathEntry[] getPackageDependencies() {
        final File[] jars = outDir.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getAbsolutePath().endsWith(".jar");
            }
        });
View Full Code Here

      Logger.error(this, "Persistent temporary files location is not a directory: " + oldTempFilesPeerDir.getPath());
      return false;
    }

    boolean gotError = false;
    File[] oldTempFiles = oldTempFilesPeerDir.listFiles(new FileFilter() {

      private final int lastGoodMainBuildNumber = Version.lastGoodBuild();

      @Override
      public boolean accept(File file) {
View Full Code Here

  public static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive, Set<Class<?>> classes) {
    File dir = new File(packagePath);
    if (!dir.exists() || !dir.isDirectory()) {
      return;
    }
    File[] dirfiles = dir.listFiles(new FileFilter() {
      public boolean accept(File file) {
        return (recursive && file.isDirectory()) || (file.getName().endsWith(".class"));
      }
    });
    for (File file : dirfiles) {
View Full Code Here

        else
        {
            stillWild = false;
        }

        for (File path : dir.listFiles(new FileFilter()
        {
            public boolean accept(File pathname)
            {
                String name = pathname.getName();
                if (pathname.isDirectory())
View Full Code Here

        scanMedia(root, result);
        return result;
    }

    private static void scanMedia(File root, List<File> result) {
        File[] files = root.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.getName().endsWith(".iso");
            }
        });

        for(File file : files) {
            result.add(file);
        }

        File[] dirs = root.listFiles(new FileFilter() {
            @Override
            public boolean accept(File pathname) {
                return pathname.isDirectory();
            }
        });
View Full Code Here

    }

    private void scanForMedia(File root, List<File> result) {
        if(root.exists() && root.isDirectory()) {
            // List all matching mp3 files...
            File[] files = root.listFiles(new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    return pathname.isFile() && pathname.getName().toLowerCase().endsWith(".mp3");
                }
            });
            // Add them to the collection
            result.addAll(Arrays.asList(files));
            // List all nested directories...
            File[] dirs = root.listFiles(new FileFilter() {
                @Override
                public boolean accept(File pathname) {
                    return pathname.isDirectory();
                }
            });
View Full Code Here

TOP

Related Classes of java.io.FileFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.