02/28/2005
 

com.vignette.portal.util
Class FileExtensionFilter

java.lang.Object
  |
  +--com.vignette.portal.util.FileExtensionFilter
All Implemented Interfaces:
FileFilter, FilenameFilter

public class FileExtensionFilter
extends Object
implements FilenameFilter, FileFilter

Filter for files of a particular extension or set of extensions. If you just need to filter for a single extension, use the constructor that accepts a string. If you want to accept any of multiple extensions, use the string array constructor. Extension matching will be case-insensitive.


Constructor Summary
FileExtensionFilter(String extension)
          Use this constructor to create a filter for just a single extension.
FileExtensionFilter(String[] extensions)
          Use this constructor to create a filter for multiple extensions.
 
Method Summary
 boolean accept(File pathname)
          Tests whether or not the specified abstract pathname should be included in a pathname list.
 boolean accept(File parentDir, String filename)
          Accept any file that ends with one of our extensions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileExtensionFilter

public FileExtensionFilter(String extension)
Use this constructor to create a filter for just a single extension.
Parameters:
extension - A single file extension to be accept.

FileExtensionFilter

public FileExtensionFilter(String[] extensions)
Use this constructor to create a filter for multiple extensions.
Parameters:
extensions - The list of file extensions to be accepted.
Method Detail

accept

public boolean accept(File parentDir,
                      String filename)
Accept any file that ends with one of our extensions.
Specified by:
accept in interface FilenameFilter
Parameters:
parentDir - The parent directory of the file to be filtered.
filename - The name of the file to be filtered.
Returns:
true if the specified filename is accepted by the extension filter.

accept

public boolean accept(File pathname)
Tests whether or not the specified abstract pathname should be included in a pathname list.
Specified by:
accept in interface FileFilter
Parameters:
pathname - The abstract pathname to be tested
Returns:
true if and only if pathname should be included

02/28/2005
 

Copyright and Trademark Notices