package com . yqq . app6 ; import java . io . FileReader ; import java . io . FileWriter ; /** * @Author yqq * @Date 2021/11/12 23:33 * @Version 1.0 */ public class FileCopyTools { public static void main ( String [] args ) { FileReader fr
import java.io.FileReader;
import java.io.FileWriter;
/**
* @Author yqq
* @Date 2021/11/12 23:33
* @Version 1.0
*/
public class FileCopyTools {
public static void main(String[] args) {
FileReader fr =null;
FileWriter fw =null;
try {
fr = new FileReader("E:/pic/z2.txt");
fw = new FileWriter("E:/pic/z3.txt");
char[] buff = new char[1024];
int temp = 0;
while ((temp= fr.read(buff))!=-1){
fw.write(buff,0,temp);
fw.flush();
}
}catch (Exception e){
e.printStackTrace();
}finally {
try {
if(fr!=null){
fr.close();
}
if(fw!=null){
fw.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
}
}