majianxiong
发贴: 6
|
于 2006-05-22 19:54
package Com.Lurece.util.file; import java.io.*; import java.util.Hashtable; import java.lang.String; import javax.servlet.*; public class file { private static String fileaddr; private static ServletContext _servletContext=null; public file() { } public void setFilePath(String fp) { fileaddr=fp; } public static void setServletContext(ServletContext context) { _servletContext = context; } public static String Rfts() { String r1; StringBuffer filesct=new StringBuffer(); try { InputStream is =_servletContext.getResourceAsStream(fileaddr); InputStreamReader fr = new InputStreamReader(is); BufferedReader in = new BufferedReader(fr); while ((r1=in.readLine())!=null) { filesct.append(r1); filesct.append("\n"); } } catch (FileNotFoundException e) { filesct.append("select"); } catch(IOException e) { filesct.append("IOException"); } return filesct.toString(); }
}
|