Examples of FileFilter


Examples of java.io.FileFilter

     */
    public static File[] findAllFilesInDirectory(String dir) {

        // Find all files in the specified directory
        File modelsDirFile = new File(dir);
        FileFilter fileFilter = new FileFilter() {

            public boolean accept(File file) {
                if (file.isDirectory()) {
                    return false;
                }
View Full Code Here

Examples of java.io.FileFilter

      public static File[] findAllFilesInDirectoryHavingExtension(String dir, final String extension) {

        // Find all files in that directory that end in XML and attempt to
        // load them into the runtime metadata database.
        File modelsDirFile = new File(dir);
        FileFilter fileFilter = new FileFilter() {
            public boolean accept(File file) {
                if(file.isDirectory()) {
                    return false;
                }
View Full Code Here

Examples of java.io.FileFilter

    if (sTorrentFilePath != null && sTorrentFilenames == null) {
      File dir = new File(sTorrentFilePath);
      if (!dir.isDirectory())
        return 0;

      final File[] files = dir.listFiles(new FileFilter() {
        public boolean accept(File arg0) {
          if (FileUtil.getCanonicalFileName(arg0.getName()).endsWith(".torrent"))
            return true;
          if (FileUtil.getCanonicalFileName(arg0.getName()).endsWith(".tor"))
            return true;
View Full Code Here

Examples of java.io.FileFilter

      e.printStackTrace();
  }
  if (!modelsDirFile.exists()) {
      return null;
  }
  FileFilter fileFilter = new FileFilter() {

      public boolean accept(File file) {
    if (file.isDirectory()) {
        return true;
    }
View Full Code Here

Examples of java.io.FileFilter

                  while (added_entry) {
                      f = f.getParentFile();
                      added_entry = files_to_move.add(f);
                  }
              }
        FileFilter ff = new FileFilter() {
          public boolean accept(File f) {return files_to_move.contains(f);}
        };
       
        if ( FileUtil.renameFile( old_file, new_save_location, false, ff )){
             
View Full Code Here

Examples of java.io.FileFilter

        File f = new File(args[0]);
        if (f.exists()) {
            if (f.isFile()) {
                ppm2Jpeg(f);
            } else {
                File[] list = f.listFiles(new FileFilter() {
                    public boolean accept(File pathname) {
                        return pathname.getName().endsWith(".ppm");
                    }
                });
                for (int i = 0; i < list.length; i++) {
View Full Code Here

Examples of java.io.FileFilter

    private static long getDirectoryLastModified(final String path) {
      final File pck = new File(System.getProperty("user.dir") + path);
      if ( !pck.exists() || !pck.isDirectory() )
        return Long.MAX_VALUE;

      final File[] classes = pck.listFiles(new FileFilter() {
        public boolean accept(final File pathname) {
          return pathname.isFile() && pathname.getName().endsWith(".class");
        }
      });
View Full Code Here

Examples of java.io.FileFilter

     */
    private class ComponentMonitor implements Runnable {

        public void run() {
            try {
                File [] jars = componentDirectory.listFiles(new FileFilter() {
                    public boolean accept(File pathname) {
                        String fileName = pathname.getName().toLowerCase();
                        return (fileName.endsWith(".jar") || fileName.endsWith(".war"));
                    }
                });

                for (int i=0; i<jars.length; i++) {
                    File jarFile = jars[i];
                    String componentName = jarFile.getName().substring(
                            0, jarFile.getName().length()-4).toLowerCase();
                    // See if the JAR has already been exploded.
                    File dir = new File(componentDirectory, componentName);
                    // If the JAR hasn't been exploded, do so.
                    if (!dir.exists()) {
                        unzipComponent(componentName, jarFile, dir);
                    }
                    // See if the JAR is newer than the directory. If so, the component
                    // needs to be unloaded and then reloaded.
                    else if (jarFile.lastModified() > dir.lastModified()) {
                        unloadComponent(componentName);
                        // Ask the system to clean up references.
                        System.gc();
                        while (!deleteDir(dir)) {
                            manager.getLog().error("Error unloading component " + componentName + ". " +
                                    "Will attempt again momentarily.");
                            Thread.sleep(5000);
                        }
                        // Now unzip the component.
                        unzipComponent(componentName, jarFile, dir);
                    }
                }

                File [] dirs = componentDirectory.listFiles(new FileFilter() {
                    public boolean accept(File pathname) {
                        return pathname.isDirectory();
                    }
                });

View Full Code Here

Examples of java.io.FileFilter

        if (!libDirectory.exists()) {
            return null;
        }

        //try to get the gradle.jar. It'll be "gradle-[version].jar"
        File[] files = libDirectory.listFiles(new FileFilter() {
            public boolean accept(File file) {
                return GRADLE_CORE_PATTERN.matcher(file.getName()).matches();
            }
        });
View Full Code Here

Examples of java.io.FileFilter

    while (list_of_dirs.size() != 0) {
      if (work_on_files.stopTraverseDir())
        return;
      current_dir = list_of_dirs.poll();
      if (with_part_met_extension)
        list_of_files = current_dir.listFiles(new FileFilter() {
          public boolean accept(File file) {
            if (file.isDirectory())
              return true;
            if (file.getName().endsWith(PART_MET_EXTENSION))
              return true;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.