/*** Usage of filter class ****/

        ListFilter filter = new ListFilter(strSomeFilter);
        File fLister = new File(strSomeFilePath);

        for (ls = fLister.list(filter), i = 0; ls != null && i < ls.length;
i++){
                System.out.println(ls[i]);  // some code to display them back in
 an html page
         }


/**** The filter class ****/

import java.io.FilenameFilter;
import java.io.File;

class ListFilter implements FilenameFilter{

    String strFilter;

    public ListFilter(String strFilter){
        this.strFilter = strFilter;
    }

    public boolean accept(File dir, String name){
        return (name.startsWith(strFilter));  // filters at start of filename
//        return (name.endsWith(strFilter));  // filters at the end of the
filename
    }

}

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to