Java2009. 5. 21. 15:26
String fileName = "output.txt";
StringBuffer buf = new StringBuffer();
File file = new File(fileName);
FileWriter writer = new FileWriter(file);

buf.append("abc" + "\r\n"); // 요부분 집중
buf.append("def" + "\r\n");
StringReader reader = new StringReader(buf.toString());

int c;
while ((c = reader.read()) != -1)
writer.write(c);

reader.close();
writer.close();

Posted by la30321