当前位置: 技术问答>java相关
在java中往一个文本文件写东西时如何换行?
来源: 互联网 发布时间:2015-03-20
本文导语: | istr = rsp.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(istr)); String line; StringBuffer result = new StringBuffer(); while ((line =...
|
istr = rsp.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(istr));
String line;
StringBuffer result = new StringBuffer();
while ((line = reader.readLine()) != null) {
result.append(line + System.getProperty("line.separator"));//加入换行符
}
BufferedReader reader = new BufferedReader(new InputStreamReader(istr));
String line;
StringBuffer result = new StringBuffer();
while ((line = reader.readLine()) != null) {
result.append(line + System.getProperty("line.separator"));//加入换行符
}