自定义缓冲区?- public class FileCopyDemo {
- public static void main(String[] args) throws IOException {
- FileWriter fw = new FileWriter("C:\\testjava\\bb.java");
- FileReader fr = new FileReader("C:\\testjava\\myjava.txt");
- char[] buf = new char[1024];
- int num = 0;
- while ((num = fr.read(buf)) != -1) {
- fw.write(buf, 0, num);
- }
- fw.close();
- fr.close();
- }
- }
复制代码 |