首页 > 其他 > 详细

字符流查看txt文件

时间:2016-02-19 14:20:44      阅读:153      评论:0      收藏:0      [点我收藏+]

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;


public class Test03 {
public static void main(String[] args) throws FileNotFoundException {
FileReader fr=new FileReader("D:\\新建文件夹\\等待春天.txt");
char c[]=new char[1024];
int b =0;
try {
while((b=fr.read(c))!=-1){
String a=new String(c, 0, b);
System.out.println(a);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

字符流查看txt文件

原文:http://www.cnblogs.com/zqsheng/p/5200682.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!