import java.io.*;
public class Test1 {
public static void main(String[] args) throws Exception {
InputStream in = new FileInputStream("诛仙.txt"); //创建输入流
OutputStream out = new FileOutputStream("诛仙副件.txt"); //创建输出流
long beginTime = System.currentTimeMillis();
byte[] arr = new byte[1024]; //创建一个数组,接收所读数据,
int len ;
while ((len= in.read(arr)) != -1) { //读取
out.write(arr); //写入
}
long endTime = System.currentTimeMillis();
System.out.println("拷贝文件所花费的时间为:"+(-beginTime + endTime)+"毫秒");
in.close();
out.close();
}
}
|
|