KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jodd > io > findfile > WildcardFindFile


1 // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
2

3 package jodd.io.findfile;
4
5 import jodd.util.Wildcard;
6
7 import java.io.File JavaDoc;
8
9 /**
10  * Simple {@link FindFile} that matches file names using wildcards.
11  * @see jodd.io.findfile.RegExpFindFile
12  */

13 public class WildcardFindFile extends FindFile {
14
15     protected String JavaDoc wildcard;
16
17     public WildcardFindFile(String JavaDoc wildcard) {
18         this.wildcard = wildcard;
19
20     }
21
22     public WildcardFindFile(String JavaDoc searchPath, String JavaDoc wildcard) {
23         this.wildcard = wildcard;
24         searchPath(searchPath);
25     }
26
27     public WildcardFindFile(File JavaDoc searchPath, String JavaDoc wildcard) {
28         this.wildcard = wildcard;
29         searchPath(searchPath);
30     }
31
32
33     public WildcardFindFile(String JavaDoc[] searchPath, String JavaDoc wildcard) {
34         this.wildcard = wildcard;
35         searchPath(searchPath);
36     }
37
38     protected boolean onFileEntry(File JavaDoc currentFile) {
39         return Wildcard.match(currentFile.getName(), wildcard);
40     }
41 }
42
Popular Tags