BufferedReader br = new BufferedReader(new FileReader(new File("aa.txt")))
String temp = null
StringBuffer sbf = new StringBuffer()
while ((temp = br.readLine()) != null) {
sbf.append(temp).append("@@ns")
}
br.close()
System.out.println(sbf.toString())
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace()
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace()
}
FileOutputStream out = new FileOutputStream("test.txt",true)构造函数里面的第二个参数为true时,代表从文件的结尾开始写,为false时,代表从头开始写
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)