视频点播 VOD-生成MD5值:上传校验
时间:2024-06-19 15:57:46
上传校验
调用上传检验接口时,点播服务会根据媒资的MD5值来检查是否已有重复的媒资文件。MD5值的生成方式是取媒资文件的1024字节,并进行MD5计算,示例代码如下所示:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import java.io.File; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SeekableByteChannel; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import org.apache.commons.codec.digest.DigestUtils; public class VodDemoDuplicateCheckMd5 { public static String computeMd5ByFile(String fileUrl) { String md5Content = null; Path targetFile = Paths.get(fileUrl); try (SeekableByteChannel channel = Files.newByteChannel(targetFile, StandardOpenOption.READ)) { ByteBuffer byteBuffer = ByteBuffer.allocate(1025); channel.read(byteBuffer); byteBuffer.flip(); byte[] data = new byte[byteBuffer.limit()]; byteBuffer.get(data); md5Content = DigestUtils.md5Hex(data); } catch (IOException e) { throw new RuntimeException(String.format("Read file %s failed.", fileUrl)); } return md5Content; } } |
support.huaweicloud.com/api-vod/vod_04_0212.html
看了此文的人还看了
CDN加速
GaussDB
文字转换成语音
免费的服务器
如何创建网站
域名网站购买
私有云桌面
云主机哪个好
域名怎么备案
手机云电脑
SSL证书申请
云点播服务器
免费OCR是什么
电脑云桌面
域名备案怎么弄
语音转文字
文字图片识别
云桌面是什么
网址安全检测
网站建设搭建
国外CDN加速
SSL免费证书申请
短信批量发送
图片OCR识别
云数据库MySQL
个人域名购买
录音转文字
扫描图片识别文字
OCR图片识别
行驶证识别
虚拟电话号码
电话呼叫中心软件
怎么制作一个网站
Email注册网站
华为VNC
图像文字识别
企业网站制作
个人网站搭建
华为云计算
免费租用云托管
云桌面云服务器
ocr文字识别免费版
HTTPS证书申请
图片文字识别转换
国外域名注册商
使用免费虚拟主机
云电脑主机多少钱
鲲鹏云手机
短信验证码平台
OCR图片文字识别
SSL证书是什么
申请企业邮箱步骤
免费的企业用邮箱
云免流搭建教程
域名价格
推荐文章