电脑爱好者,提供IT资讯信息及各类编程知识文章介绍,欢迎大家来本站学习电脑知识。 最近更新 | 联系我们 RSS订阅本站最新文章
电脑爱好者
站内搜索: 
当前位置:首页>> jsp>>Jsp读取文本文件的代码:

Jsp读取文本文件的代码

来源:网络 | 2007-3-8 | (有5034人读过)

以下为Jsp读取文本文件的部分代码,用到的class可以在api中看看  
public static void fileWriteLine(String file, String text) throws IOException {  
PrintWriter out = new PrintWriter(new FileWriter(file));  
out.print(text);  
out.close();  
}  
public static StringBuffer fileReadLine(String file) throws IOException {  
BufferedReader br = new BufferedReader(new FileReader(file));  
String record = new String();  
StringBuffer sb = new StringBuffer();  
while ((record = br.readLine()) != null) {  
sb.append(record);  
}  
br.close();  
return sb;  
}  
jsp热门文章排行
网站赞助商
购买此位置

 

关于我们 | 网站地图 | 文档一览 | 友情链接| 联系我们

Copyright © 2003-2024 电脑爱好者 版权所有 备案号:鲁ICP备09059398号