1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.vfs;
18
19 /***
20 * A {@link FileSelector} that selects files of a particular type.
21 *
22 * @author <a href="mailto:adammurdoch@apache.org">Adam Murdoch</a>
23 * @version $Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
24 */
25 public class FileTypeSelector
26 implements FileSelector
27 {
28 private final FileType type;
29
30 public FileTypeSelector(final FileType type)
31 {
32 this.type = type;
33 }
34
35 /***
36 * Determines if a file or folder should be selected.
37 */
38 public boolean includeFile(final FileSelectInfo fileInfo)
39 throws FileSystemException
40 {
41 return (fileInfo.getFile().getType() == type);
42 }
43
44 /***
45 * Determines whether a folder should be traversed.
46 */
47 public boolean traverseDescendents(final FileSelectInfo fileInfo)
48 {
49 return true;
50 }
51 }