package com.itcast.demo02.InputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* @author newcityman
* @date 2019/7/28 - 9:38
* 题目要求:
* 使用输入流和输出流的知识,复制文件从源文件路径到目标路径
*/
public class Demo03InputStream {
public static void main(String[] args) throws IOException {
long l = System.currentTimeMillis();
FileInputStream fis = new FileInputStream("D:\\节日任务.docx");
FileOutputStream fos = new FileOutputStream("F:\\1.docx");
byte[] bytes = new byte[2048];
int len = 0;
while((len=fis.read(bytes))!=-1){
fos.write(bytes,0,len);
}
fis.close();
fos.close();
long l1 = System.currentTimeMillis();
System.out.println("总耗时:"+(l1-l)+"毫秒");
}
}