package com.winjing.testing.utils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
PrintWriter pw;
try {
Double num = 1.2;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = format.format(new Date());
pw = new PrintWriter(new FileWriter( "D:\\test.txt" ));
pw.print(num + "\t" + time);
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void DOWriteTxt(String file, String txt) {
try {
FileOutputStream os = new FileOutputStream(new File(file), true);
os.write((txt + "\n").getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
}