Java写入文件到web根目录的配置文件里

阅读更多
/**
 * 
 */
package com.ape.weibo.basedata.utils;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * @author Happy
 * @me @快乐每一天Joe
 * @mail [email protected]
 * @date 2012-1-31
 */
public class OperaFile {
	public void writeFile(String content) {
		try {
			BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream("./src/main/config/weibo_url.txt"),
					"UTF-8"));
			out.write(content);
			out.newLine();
			out.flush();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		OperaFile operaFile = new OperaFile();
		operaFile.writeFile("jjjjjjjjjjjjjjj\r\neeeeeeee");
	}

}

你可能感兴趣的:(java,配置,文件,写入)