01: // Copyright (c) 2003-2007, Jodd Team (jodd.sf.net). All Rights Reserved.
02:
03: package jodd.io.filter;
04:
05: import java.io.File;
06:
07: abstract class FileFilterBase implements FileFilterEx {
08:
09: /**
10: * Tests whether or not the specified abstract pathname should be
11: * included in a pathname list.
12: *
13: * @param file The abstract pathname to be tested
14: * @return <code>true</code> if and only if <code>pathname</code>
15: * should be included
16: */
17: public boolean accept(File file) {
18: return accept(file.getParentFile(), file.getName());
19: }
20:
21: /**
22: * Tests if a specified file should be included in a file list.
23: *
24: * @param dir the directory in which the file was found.
25: * @param name the name of the file.
26: * @return <code>true</code> if and only if the name should be
27: * included in the file list; <code>false</code> otherwise.
28: */
29: public boolean accept(File dir, String name) {
30: return accept(new File(dir, name));
31: }
32:
33: }
|