www.pudn.com > xiorkflow.rar > SingleIOFilenameFilter.java, change:2006-08-19,size:669b


package name.xio.util; 
 
import java.io.File; 
import java.io.FilenameFilter; 
 
public class SingleIOFilenameFilter implements FilenameFilter { 
 
    public SingleIOFilenameFilter(String extend) { 
        this.extend = extend; 
    } 
 
    public boolean accept(File dir, String name) { 
        int index = name.lastIndexOf(PathUtil.SEPARATOR_FORMAT); 
        if ((index > 0) && (index < (name.length() - 1))) { 
            String extension = name.substring(index + 1).toLowerCase(); 
            if (extension.equalsIgnoreCase(extend)) { 
                return true; 
            } 
        } 
        return false; 
    } 
 
    private String extend; 
 
}