FileReader/FileWriter的实例

作者在 2010-05-21 14:22:39 发布以下内容
import java.io.*;
public class Test {
    public static void main(String[] args) {
        try {
            FileReader input = new FileReader("a.txt");
            FileWriter output = new FileWriter("temp.txt");
            int read = input.read();        
            while ( read != -1 ) {
                output.write(read);    
                read = input.read();
            }            
            input.close();
            output.close();
        } catch (IOException e) {
            System.out.println(e);
        }
    }
}
I/O编 | 阅读 973 次
文章评论,共0条
游客请输入验证码
浏览290927次