首先,进行文件分割
File savePath = new File("Part");
File moveFile = new File("001.mp4");
cutFile(savePath, moveFile);
private static void cutFile(File parent, File file) throws IOException {
if (!file.exists()) {
System.out.println("文件不存在");
return;
}
parent.mkdirs();
// 使用缓冲装饰类来读取视频文件数据
BufferedInputStream buffIn = new BufferedInputStream(new FileInputStream(file));
// 创建一个字节缓冲数组
byte[] buff = new byte[1024 * 1024 * 10];
int num = 0;
int i = 1;
while ((num = buffIn.read(buff)) != -1) {
File saveP = new File(parent, i + ".part");
FileOutputStream out = new FileOutputStream(saveP);
i++;
out.write(buff, 0, num);
out.flush();
out.close();
}
Properties pro = new Properties();
pro.setProperty("filename", file.getName());
pro.setProperty("partCount", i + "");
FileOutput