All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.io.FileExtensionFilter

java.lang.Object
   |
   +----sdsu.io.FileExtensionFilter

public class FileExtensionFilter
extends Object
implements FilenameFilter
FileExtensionFilter can be used by java.io.File and java.awt.FileDialog to select files with a given file extension. A file extension is the text after a "." in the file name. So foo.bar.txt has the extension txt, it also has the extension .bar.txt. Given either extension the filter will return the file foo.bar.txt. The comparison of the file extension is not case sensitive. So .txt is considered the same as .TXT A sample use:
		File currentDirectory = new File( "." );
		String[] listing = currentDirectory.list( new FileExtensionFilter("html"));
 
gives all the file ending in .html in the current directory.

Version:
1.0 11 November 1997
Author:
Roger Whitney (whitney@cs.sdsu.edu)

Constructor Index

 o FileExtensionFilter(String)

Method Index

 o accept(File, String)
Called by File and FileDialog to select files.

Constructors

 o FileExtensionFilter
 public FileExtensionFilter(String extension)
Parameters:
extension - the file extension to be filtered for. The strings .txt and txt will both filter for files ending in .txt

Methods

 o accept
 public boolean accept(File directory,
                       String fileName)
Called by File and FileDialog to select files. Returns true on file names that File and FileDialog should accept


All Packages  Class Hierarchy  This Package  Previous  Next  Index