ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.conversation
Class FilterByExtension

java.lang.Object
  |
  +--com.ibm.able.conversation.FilterByExtension
All Implemented Interfaces:
java.io.FileFilter

public class FilterByExtension
extends java.lang.Object
implements java.io.FileFilter

The FilterByExtension class accepts files with extensions that match a given string.

The user specifies the extension to be accepted (in all lower case), and optionally, whether to accept directories (the default is to do so).


Constructor Summary
FilterByExtension(java.lang.String extension)
          Constructs a FilterByExtension object.
 
Method Summary
 boolean accept(java.io.File arg0)
           
 java.lang.String getAcceptedExtension()
          Returns the extension used in accepting files.
static java.lang.String getExtension(java.io.File file)
          Returns the extension of the given file.
 boolean isDirectoriesAccepted()
          Indicates whether directories are accepted by this filter.
 void setAcceptedExtension(java.lang.String extension)
          Sets the extension to use in accepting files.
 void setDirectoriesAccepted(boolean directoriesAccepted)
          Sets the flag that indicates whether directories are accepted by this filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterByExtension

public FilterByExtension(java.lang.String extension)
Constructs a FilterByExtension object.

Parameters:
extension - The extension to filter on. (Automatically mapped to lower case.)
Method Detail

getAcceptedExtension

public java.lang.String getAcceptedExtension()
Returns the extension used in accepting files.

Returns:
The extension

setAcceptedExtension

public void setAcceptedExtension(java.lang.String extension)
Sets the extension to use in accepting files.

The given string is mapped to lower case.

Parameters:
extension - The extension to use in accepting files.

isDirectoriesAccepted

public boolean isDirectoriesAccepted()
Indicates whether directories are accepted by this filter. Default is true.

Returns:
true if directories are accepted, false if not.

setDirectoriesAccepted

public void setDirectoriesAccepted(boolean directoriesAccepted)
Sets the flag that indicates whether directories are accepted by this filter.

Parameters:
directoriesAccepted - The flag.

getExtension

public static java.lang.String getExtension(java.io.File file)
Returns the extension of the given file.

Parameters:
file - the File object representing the file
Returns:
the extension of the file's filename (mapped to lower case).

accept

public boolean accept(java.io.File arg0)
Specified by:
accept in interface java.io.FileFilter

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003