edu.stanford.nlp.io
Class ExtensionFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by edu.stanford.nlp.io.ExtensionFileFilter
All Implemented Interfaces:
FileFilter

public class ExtensionFileFilter
extends FileFilter
implements FileFilter

Implements a file filter that uses file extensions to filter files.

Author:
cmanning 2000/01/24

Constructor Summary
ExtensionFileFilter(String ext)
          Sets up an extension file filter that will recurse into sub directories.
ExtensionFileFilter(String ext, boolean recurse)
          Sets up Extension file filter by specifying an extension to accept (currently only 1) and whether to also display folders for recursive search.
 
Method Summary
 boolean accept(File file)
          Checks whether a file satisfies the selection filter.
 String getDescription()
          Returns a description of what extension is being used (for file choosers).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionFileFilter

public ExtensionFileFilter(String ext,
                           boolean recurse)
Sets up Extension file filter by specifying an extension to accept (currently only 1) and whether to also display folders for recursive search. The passed extension may be null, in which case the filter will pass all files (passing an empty String does not have the same effect -- this would look for file names ending in a period)

Parameters:
ext - File extension (not including period) or null for any
recurse - go into folders

ExtensionFileFilter

public ExtensionFileFilter(String ext)
Sets up an extension file filter that will recurse into sub directories.

Method Detail

accept

public boolean accept(File file)
Checks whether a file satisfies the selection filter.

Specified by:
accept in interface FileFilter
Specified by:
accept in class FileFilter
Parameters:
file - The file
Returns:
true if the file is acceptable

getDescription

public String getDescription()
Returns a description of what extension is being used (for file choosers). For example, if the suffix is "xml", the description will be "XML Files (*.xml)".

Specified by:
getDescription in class FileFilter
Returns:
description of this file filter


Stanford NLP Group