Posted on 2007-03-04 10:22
semovy 阅读(306)
评论(0) 编辑 收藏 所属分类:
JAVA基础
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("infilename")));
不管你从磁盘读,从网络读,或者从键盘读,读到内存,就是InputStream。
写文件
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("outfilename")));
不管你写倒磁盘,写到网络,或者写到屏幕,都是OuputStream。
BufferedReader br = new BufferedReader(new InputStreamReader(is));
while((tem = br.readLine())!= null)
{
System.out.println(tem);
}