public static void copyVideo() throws Exception{
File file = new File("d:\\test.mp4");
FileInputStream fis = new FileInputStream(file);
FileOutputStream fos = new FileOutputStream("d:\\test-副本.mp4");
long length = file.length();
long count = 0;
long lastbfb = 0;
int len;
byte[] bs = new byte[8192];
while((len=fis.read(bs))!=-1) {
fos.write(bs,0,len);
count +=len;
long bf = (count*100)/length;
if(bf>lastbfb){
System.out.println(bf+"%");
lastbfb = bf;
}
}
fis.close();
fos.close();
}
复制一个视频, 提示用户百分比完成度
猜你喜欢
转载自blog.csdn.net/moxiaomo0804/article/details/89547917
今日推荐
周排行