1 3 package jodd.io.findfile; 4 5 import java.io.File ; 6 import java.io.FileFilter ; 7 import java.util.List ; 8 import java.util.ArrayList ; 9 10 13 public class FilterFindFile extends FindFile { 14 15 public FilterFindFile() { 16 } 17 18 public FilterFindFile(String searchPath) { 19 super(searchPath); 20 } 21 22 public FilterFindFile(File searchPath) { 23 super(searchPath); 24 } 25 26 public FilterFindFile(String [] searchPath) { 27 super(searchPath); 28 } 29 30 32 protected List ffilters = null; 33 34 37 public FindFile addFilters(FileFilter [] ff) { 38 if (ffilters == null) { 39 ffilters = new ArrayList (); 40 } 41 for (int i = 0; i < ff.length; i++) { 42 ffilters.add(ff[i]); 43 } 44 return this; 45 } 46 47 50 public FindFile addFilter(FileFilter ff) { 51 if (ffilters == null) { 52 ffilters = new ArrayList (); 53 } 54 ffilters.add(ff); 55 return this; 56 } 57 58 62 protected boolean onFileEntry(File currentFile) { 63 if (ffilters != null) { 64 for (int i = 0; i < ffilters.size(); i++) { 65 FileFilter ff = (FileFilter ) ffilters.get(i); 66 if (ff.accept(currentFile) == false) { 67 return false; 68 } 69 } 70 } 71 return true; 72 } 73 74 75 } 76 | Popular Tags |