http://blog.naver.com/suncsj?Redirect=Log&logNo=80026144933
FileWriter는 가독성 때문에 "\n"을 지원하지 않는다.,
그래서 파일출력시 줄단위로 출력을 하기 위해서는.,.
BufferedWriter를 사용한다..
예제)
public void StoreFile(String name)
{
try{
File f1 = new File(getPath(),name);
BufferedWriter bw = new BufferedWriter(new FileWriter(f1));
for(int j = 0; j < this.name.length;j++)
{
bw.write(this.name[j]+" "+this.weight[j]);
bw.newLine();
}
bw.flush();
bw.close();
}catch(IOException e){e.getMessage();}
}
[출처] 자바(Java)에서 파일출력시 개행문자|작성자 지지
'Java Programming' 카테고리의 다른 글
같은 package에서 class접근 (0) | 2011.05.12 |
---|---|
Class getSimpleName() vs. getName() (0) | 2010.10.25 |
How to read output from a Command execution (0) | 2010.10.04 |
Invoking Methods by Name (0) | 2010.09.27 |
static 변수 garbage collection (0) | 2010.07.14 |