IO

/**
 * @author fengshangxian
 * @date 2021/5/12  9:38
 */
public class Test01 {
    public static void main(String[] args) throws Exception{
       BufferedReader  reader=new BufferedReader  (new FileReader("D:\\three.txt"));
        BufferedWriter writer=new BufferedWriter(new FileWriter("C:\\des\\hah.txt"));
        int len=0;
        char[]buffer =new char[1024];
        long start=System.currentTimeMillis();//获取程序执行之前的时间戳
        while((len=reader.read(buffer))!=-1){
            writer.write(buffer,0,len);
        }
        writer.flush();
        long ead=System.currentTimeMillis();
        System.out.println("时间:"+(ead -start));
        reader.close();
        writer.close();

    }
    
}

你可能感兴趣的:(IO)