方法名 | 说明 |
BufferedWriter(Writer out) | 创建字符缓冲输出流对象 |
BufferedReader(Reader in) | 创建字符缓冲输入流对象 |
package com.d04_file.itheima09;
import java.io.*;
/*
BufferedWriter(Writer out) 创建字符缓冲输出流对象
BufferedReader(Reader in) 创建字符缓冲输入流对象
*/
public class CopyJavaDemo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new FileReader("src\\com\\d04_file\\itheima08\\aa.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("src\\com\\d04_file\\itheima09\\aa.txt"));
int i;
while ((i = br.read())!=-1){
bw.write(i);
}
br.close();
bw.close();
}
}