Java IO之有缓冲的文本输出

就是写入一个文件,即Output(O)。


package com.sinosuperman.driver;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class MainBench {
	public static void main(String[] args) throws IOException {
		MyStream stream = new MyStream("temp/test.txt");
	}
}

class MyStream {
	public MyStream(String pathName) throws IOException {
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(new File(pathName))));
		out.println("I'm Michael C. Zhong");
		out.println("Education Background:");
		out.println("\t2006-2011, University of Science and Technology of China.");
		out.print("\tComputer Science and Technology, Bachelor Degree.");
		out.close();
	}
}



原文链接: http://blog.csdn.net/poechant/article/details/6998735

你可能感兴趣的:(Java IO之有缓冲的文本输出)