javaee字节流文件复制
package Zy; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Zy { //1.用字节流完成eclipse.zip的复制 public static void main(String[] args) throws IOException { long time1=System.currentTimeMillis(); FileInputStream fis=new FileInputStream("e:\\eclipse.zip"); FileOutputStream fos=new FileOutputStream("e:\\java\\eclipse.zip"); byte[] bytes=new byte[1024]; int len=0; while((len=fis.read(bytes))!=-1){ fos.write(bytes,0,len); } fis.close(); fos.close(); long time2=System.currentTimeMillis(); System.out.println((time2-time1)/1000); } }