com.mccrory.scott.base
Class ConcreteFilenameFilter
java.lang.Object
|
+--com.mccrory.scott.base.ConcreteFilenameFilter
- All Implemented Interfaces:
- java.io.FilenameFilter
- public class ConcreteFilenameFilter
- extends java.lang.Object
- implements java.io.FilenameFilter
A case-insensitive, concrete implementation of java.io.FilenameFilter.
Patterned after an example in Bruce Eckel's "Thinking in Java".
Example:
// Get a list of XML files in a directory
ConcreteFilenameFilter xmlFilter = new ConcreteFilenameFilter(".xml");
File fileList[] = prefsDir.listFiles(xmlFilter);
if (fileList == null || fileList.length < 1) {
throw new IOException("'" + prefsDirString + "' has no .xml files in it!");
}
- Version:
- CVS $Id: ConcreteFilenameFilter.java,v 1.19 2002/08/04 22:04:53 smccrory Exp $
- Author:
- Scott McCrory.
|
Method Summary |
boolean |
accept(java.io.File dir,
java.lang.String name)
Required for the FilenameFilter interface. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConcreteFilenameFilter
public ConcreteFilenameFilter(java.lang.String fileFilter)
- ConcreteFilenameFilter constructor.
- Parameters:
fileFilter - The filename filter
accept
public boolean accept(java.io.File dir,
java.lang.String name)
- Required for the FilenameFilter interface.
- Specified by:
accept in interface java.io.FilenameFilter
- Parameters:
dir - The directoryname - The filename- Returns:
- boolean Validity indicator
Copyright © 2002 Scott McCrory as part of the Spumoni project. All Rights Reserved.