Buffered Writer 출력 흐름 사용
989 단어 -----【java】
package com.lzxa.analyze.common;
import java.io.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
*
*/
public class IOBufferedWriter {
static public void IOBufferedWriters(String name) {
try{
//1. BufferedWriter c:/a.txt
//true ,
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream("c:/a.txt",true)));
//
DateFormat bf = new SimpleDateFormat("yyyy-MM-dd E a HH:mm:ss");
Date date = new Date();//
String format = bf.format(date);// bf.format(date);
//2. "last demo!"
bw.write(format+":"+name+ "\r
");
//3.
bw.close();
}catch(Exception e){
e.printStackTrace();
}
}
}