Examples of FileFilter


Examples of java.io.FileFilter

    System.out.format("%5d", have);
    System.out.print((want != have) ? "*" : " ");
  }

  public void readAll() throws IOException {
    readAllDir(testDir, new FileFilter() {

      public boolean accept(File pathname) {
        return pathname.getName().endsWith(".h5") || pathname.getName().endsWith(".he5");
      }
    });
View Full Code Here

Examples of java.io.FileFilter

    System.out.format("%5d", have);
    System.out.print((want != have) ? "*" : " ");
  }

  public void makeReadAndCountAll() throws IOException {
    testReadAndCountAllInDir("C:/data/hdf4/", new FileFilter() {
      public boolean accept(File pathname) {
        return pathname.getName().endsWith(".hdf") || pathname.getName().endsWith(".15");
      }
    }); // */
  }
View Full Code Here

Examples of java.io.FileFilter

    private boolean bOptSeen;
    private String epAddr;

    protected void start(String[] args) throws Exception {
        ProviderFactory ph = createProviderFactory();
        FileFilter jsFilter = new JSFilter();
        int i = 0;
        boolean fileSeen = false;
        boolean msgPrinted = false;
        for (;;) {
            if (i == args.length) {
                break;
            }
            if (args[i].startsWith("-")) {
                i = checkOption(args, i);
                if (verbose && !msgPrinted) {
                    msgPrinted = true;
                    System.out.println("entering server");
                }
            } else {
                File f = new File(args[i]);
                if (f.isFile() && jsFilter.accept(f)) {
                    fileSeen = true;
                    if (verbose) {
                        System.out.println("processing file " + f.getCanonicalPath());
                    }
                    ph.createAndPublish(f, epAddr, bOptSeen);
View Full Code Here

Examples of java.io.FileFilter

        if (renameConfig.isSearchSimiliarDirectoriesEnabled()
            && !result.exists()) {
          // If not exists and search is activated.
          final String directoryName = result.getName();
          File[] similiars = result.getParentFile().listFiles(
              new FileFilter() {
                public boolean accept(File pathname) {
                  return pathname.isDirectory()
                      && pathname.getName()
                          .equalsIgnoreCase(
                              directoryName);
View Full Code Here

Examples of java.io.FileFilter

                dirExists = false;
            }
        }

        // Creating a filter that catches directories.
        FileFilter dirFilter = new FileFilter() {
            public boolean accept(File f) {
                return f.isDirectory();
            }
        };

        assertNull("listFiles Should Return Null.", baseDir
                .listFiles(dirFilter));

        assertTrue("Failed To Create Parent Directory.", baseDir.mkdir());

        FileWrapper dir1 = null;
        String[] files = { "1.tst", "2.tst", "3.tst" };
        try {
            assertEquals("listFiles Should Return An Array Of Length 0.", 0,
                    baseDir.listFiles(dirFilter).length);

            FileWrapper file = new FileWrapperImpl(baseDir, "notADir.tst");
            try {
                FileOutputStream fos = new FileOutputStream(file.getAbsolutePath());
                fos.close();
                assertNull(
                        "listFiles Should Have Returned Null When Used On A File Instead Of A Directory.",
                        file.listFiles(dirFilter));
            } finally {
                file.delete();
            }

            for (int i = 0; i < files.length; i++) {
                FileWrapper f = new FileWrapperImpl(baseDir, files[i]);
                FileOutputStream fos = new FileOutputStream(f.getAbsolutePath());
                fos.close();
            }
            dir1 = new FileWrapperImpl(baseDir, "Temp1");
            dir1.mkdir();

            // Creating a filter that catches files.
            FileFilter fileFilter = new FileFilter() {
                public boolean accept(File f) {
                    return f.isFile();
                }
            };
View Full Code Here

Examples of java.io.FileFilter

    File[] feedFiles = feedFolder.listFiles();
    for (File file : feedFiles) {
      file.delete();
    }

    FileFilter filter = new FileFilter() {
      public boolean accept(File pathname) {
       return pathname.getName().contains("zip");
      }
    };
View Full Code Here

Examples of java.io.FileFilter

    * @param invalidList  a list of error messages
    * @param failIfInvalid  whether to fail immediately after the first invalid file
    */
   private void scan(java.io.File f, final Set<String> names, final List<String> invalidList, final boolean failIfInvalid)
   {
      f.listFiles(new FileFilter()
      {
         public boolean accept(File pathname)
         {
            if (pathname.isDirectory())
            {
View Full Code Here

Examples of java.io.FileFilter

      // list only xml files.
      // Note: returns null only if the path name isn't a directory
      // or I/O exception occured
      File[] files = metaInf.listFiles(
        new FileFilter()
        {
           public boolean accept(File file)
           {
              if( file.getName().endsWith( ".xml" )
                 && !file.isDirectory() )
View Full Code Here

Examples of java.io.FileFilter

   {
      // return val
      List files = new ArrayList();

      // anonymous class
      FileFilter dirFilter = new FileFilter()
      {
         public boolean accept(File file)
         {
            return file.isDirectory() && !file.getName().startsWith(".");
         }
View Full Code Here

Examples of java.io.FileFilter

      if (deleteInTearDown)
      {
         File hypersonicDir = new File(HYPERSONIC_DIR);
         if (hypersonicDir.exists() && hypersonicDir.isDirectory())
         {
            FileFilter filter = new FileFilter() {
               public boolean accept(File file)
               {
                  return file.getName().indexOf(DB_NAME) >= 0;
               }
            };
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.