com.aliasi.io
Class FileExtensionFilter

java.lang.Object
  extended by com.aliasi.io.FileNameFilter
      extended by com.aliasi.io.FileExtensionFilter
All Implemented Interfaces:
FileFilter

public class FileExtensionFilter
extends FileNameFilter

A file filter that accepts all base files with a suffix with a specified value or one of a set of specified values. The extensions are specified in the constructor, and the filter may be set to accept or reject directories. A file is tested by name against String.endsWith(String).

Since:
LingPipe1.0
Version:
3.9.1
Author:
Bob Carpenter

Constructor Summary
FileExtensionFilter(String extension)
          Create a file filter that accepts files with the specified extension and accepts all directories.
FileExtensionFilter(String[] extensions)
          Create a file filter that accepts files with the specified extensions and accepts all directories.
FileExtensionFilter(String[] extensions, boolean acceptDirectories)
          Create a file filter that accepts files with the specified extensions, optionally accepting directories.
FileExtensionFilter(String extension, boolean acceptDirectories)
          Create a file filter that accepts files with the specified extension, optionally accepting directories.
 
Method Summary
protected  boolean accept(String fileName)
          Returns true if the specified file name has an acceptable suffix as specified in the constructor.
 
Methods inherited from class com.aliasi.io.FileNameFilter
accept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileExtensionFilter

public FileExtensionFilter(String[] extensions,
                           boolean acceptDirectories)
Create a file filter that accepts files with the specified extensions, optionally accepting directories.

Parameters:
extensions - Suffixes of files to accept.
acceptDirectories - true if all directories should be accepted by this filter.

FileExtensionFilter

public FileExtensionFilter(String extension,
                           boolean acceptDirectories)
Create a file filter that accepts files with the specified extension, optionally accepting directories.

Parameters:
extension - Suffix of files to accept.
acceptDirectories - true if all directories should be accepted by this filter.

FileExtensionFilter

public FileExtensionFilter(String extension)
Create a file filter that accepts files with the specified extension and accepts all directories.

Parameters:
extension - Suffix of files to accept.

FileExtensionFilter

public FileExtensionFilter(String[] extensions)
Create a file filter that accepts files with the specified extensions and accepts all directories.

Parameters:
extensions - Suffixes of files to accept.
Method Detail

accept

protected final boolean accept(String fileName)
Returns true if the specified file name has an acceptable suffix as specified in the constructor.

Specified by:
accept in class FileNameFilter
Parameters:
fileName - Name of file to test for acceptance.
Returns:
true If file name is acceptable.