读取文件

public String BufferedReaderDemo(String path) throws IOException...{
File file=new File(path);
if(!file.exists()||file.isDirectory())
throw new FileNotFoundException();
BufferedReader br=new BufferedReader(new FileReader(file));
String temp=null;
StringBuffer sb=new StringBuffer();
temp=br.readLine();
while(temp!=null)...{
sb.append(temp+" ");
temp=br.readLine();
}
return sb.toString();
}
posted @ 2014-05-12 18:43  麦二蛋  阅读(136)  评论(0编辑  收藏  举报