本次作业实现实现了大文件快速拷贝
package copy;
import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException;public class CopyFile {
/** * @param args */ public static void main(String[] args) { long startTime = System.currentTimeMillis(); try { FileInputStream fis = new FileInputStream ("a.mp3"); FileOutputStream fos = new FileOutputStream ("temp.mp3"); int read = fis.read(); byte[] b = new byte[1024*1000]; int len = 0 ; while((len=fis.read(b)) != -1){ fos.write(b,0,len); } fis.close(); fos.close(); } catch (IOException e) { e.printStackTrace(); }long endTime = System.currentTimeMillis();System.out.println("复制时间:"+(endTime-startTime)+"ms");
}
}