com.kirkwarez.kirkpack.io.filter.file
Class ExtensionFileFilter

java.lang.Object
  extended bycom.kirkwarez.kirkpack.io.filter.file.NormalFileFilter
      extended bycom.kirkwarez.kirkpack.io.filter.file.ExtensionFileFilter
All Implemented Interfaces:
FileFilter
Direct Known Subclasses:
WDYSFileFilter, WDYSVFileFilter

public class ExtensionFileFilter
extends NormalFileFilter
implements FileFilter

This class is used for filtering out files with the given extension(s) when using java.io.File.listFiles(java.io.FileFilter) or other things requiring file filters.

Since:
3.00
Version:
3.00
Author:
Berend "Kirk" Wouda
See Also:
File

Field Summary
protected  String[] extensions
          The extension to filter on.
 
Constructor Summary
ExtensionFileFilter(String extension)
          Constructs a new filter that filters out files with the given extension.
ExtensionFileFilter(String[] extensions)
          Constructs a new filter that filters out files with the given extensions.
 
Method Summary
 boolean accept(File file)
          Returns whether when the passed file should be included in the listing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

extensions

protected String[] extensions
The extension to filter on.

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(String extension)
Constructs a new filter that filters out files with the given extension.

Parameters:
extension - The extension, without a period.

ExtensionFileFilter

public ExtensionFileFilter(String[] extensions)
Constructs a new filter that filters out files with the given extensions.

Parameters:
extensions - The extensions, without periods.
Method Detail

accept

public boolean accept(File file)
Returns whether when the passed file should be included in the listing. If it is a file with any of the given extensions, it should.

Specified by:
accept in interface FileFilter
Overrides:
accept in class NormalFileFilter
Parameters:
file - The file to be checked upon.
Returns:
Whether the file is an accepted file.