Cache new byte [101024]; If the file size is large, for example, greater than 1 GB, set the file size to 101024 x 1024

File File = new File("kk.avi"); FileInputStream = new FileInputStream(file); FileOutputStream = new FileOutputStream("kk3.avi"); Date date=new Date(); DateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS"); System.out.println("start: "+format.format(date)); Byte [] bytes = new byte[10*1024]; int readLength = 0; while ((readLength=fileInputStream.read(bytes))! =-1){ // System.out.println("readLength= " +readLength); fileOutputStream.write(bytes,0,readLength); } fileInputStream.close(); fileOutputStream.close(); Date date1=new Date(); DateFormat format1=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SS"); System.out.println("end: "+format1.format(date1));Copy the code