BufferedReader和BufferedWriter实例

作者在 2010-05-21 14:31:18 发布以下内容
import java.io.*;
public class Test {
    public static void main(String[] args) {
        try {
            FileReader input = new FileReader("Test.java");
            BufferedReader br = new BufferedReader(input);
            FileWriter output = new FileWriter("temp.txt");
            BufferedWriter bw = new BufferedWriter(output);
            String s = br.readLine();            
            while ( s!=null ) {
                bw.write(s);
                bw.newLine();        
                s = br.readLine();
            }            
            br.close();
            bw.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
I/O编 | 阅读 908 次
文章评论,共0条
游客请输入验证码
浏览290919次