这是一个简单的读取文件内容的方法:
public String readFile(String fileName) throws Exception {
String fileContent = "";
File f = new File(fileName);
FileReader fileReader = new FileReader(f);
BufferedReader reader = new BufferedReader(fileReader);
String line = "";
while (line = reader.readLine() != null) {
String fileContent = fileContent + line;
}
reader.close();
return fileContent;
}
posted on 2007-08-24 09:59
teasp 阅读(4075)
评论(0) 编辑 收藏 所属分类:
Java学习