All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sdsu.io.FilePrefixFilter

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

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

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

Constructor Index

 o FilePrefixFilter(String)

Method Index

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

Constructors

 o FilePrefixFilter
 public FilePrefixFilter(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.


All Packages  Class Hierarchy  This Package  Previous  Next  Index