View Javadoc

1   
2   package org.paneris.util;
3   import java.io.File;
4   import java.io.FilenameFilter;
5    
6   /**
7   filters filename according to their extension
8   **/
9   
10  public class ExtensionFilter implements FilenameFilter {
11  
12      private String extension;
13  
14  /**
15  * constructor
16  */
17      public ExtensionFilter(String ext) {
18          extension = ext;
19      }
20  
21  /**
22  * check if this file matches what we are after
23  */
24      public  boolean accept(File dir, String name) {
25          if (name.endsWith(extension)) {
26              return true;
27          } else {
28              return false;
29          }
30      }
31  
32  }