本文整理汇总了Java中com.netease.nim.uikit.common.util.string.MD5类的典型用法代码示例。如果您正苦于以下问题:Java MD5类的具体用法?Java MD5怎么用?Java MD5使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MD5类属于com.netease.nim.uikit.common.util.string包,在下文中一共展示了MD5类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onGetLocalVideoResult
import com.netease.nim.uikit.common.util.string.MD5; //导入依赖的package包/类
/**
* 获取本地相册视频回调操作
*/
public void onGetLocalVideoResult(final Intent data) {
if (data == null) {
return;
}
String filePath = filePathFromIntent(data);
if (StringUtil.isEmpty(filePath) || !checkVideoFile(filePath)) {
return;
}
String md5 = MD5.getStreamMD5(filePath);
String filename = md5 + "." + FileUtil.getExtensionName(filePath);
String md5Path = StorageUtil.getWritePath(filename, StorageType.TYPE_VIDEO);
if (AttachmentStore.copy(filePath, md5Path) != -1) {
if (listener != null) {
listener.onVideoPicked(new File(md5Path), md5);
}
} else {
Toast.makeText(activity, R.string.video_exception, Toast.LENGTH_SHORT).show();
}
}
示例2: onCaptureVideoResult
import com.netease.nim.uikit.common.util.string.MD5; //导入依赖的package包/类
/**
* 拍摄视频后回调操作
*/
public void onCaptureVideoResult(Intent data) {
if (videoFile == null || !videoFile.exists()) {
return;
}
//N930拍照取消也产生字节为0的文件
if (videoFile.length() <= 0) {
videoFile.delete();
return;
}
String videoPath = videoFile.getPath();
String md5 = MD5.getStreamMD5(videoPath);
String md5Path = StorageUtil.getWritePath(md5 + ".mp4", StorageType.TYPE_VIDEO);
if (AttachmentStore.move(videoPath, md5Path)) {
if (listener != null) {
listener.onVideoPicked(new File(md5Path), md5);
}
}
}
示例3: tokenFromPassword
import com.netease.nim.uikit.common.util.string.MD5; //导入依赖的package包/类
private String tokenFromPassword(String password) {
String appKey = readAppKey(this);
boolean isDemo = "45c6af3c98409b18a84451215d0bdd6e".equals(appKey)
|| "fe416640c8e8a72734219e1847ad2547".equals(appKey);
return isDemo ? MD5.getStringMD5(password) : password;
}
示例4: sendImageAfterPreviewPhotoActivityResult
import com.netease.nim.uikit.common.util.string.MD5; //导入依赖的package包/类
public static void sendImageAfterPreviewPhotoActivityResult(Intent data, Callback callback) {
final ArrayList<String> selectedImageFileList = data.getStringArrayListExtra(Extras.EXTRA_SCALED_IMAGE_LIST);
final ArrayList<String> origSelectedImageFileList = data.getStringArrayListExtra(Extras.EXTRA_ORIG_IMAGE_LIST);
boolean isOrig = data.getBooleanExtra(Extras.EXTRA_IS_ORIGINAL, false);
for (int i = 0; i < selectedImageFileList.size(); i++) {
String imageFilepath = selectedImageFileList.get(i);
File imageFile = new File(imageFilepath);
String origImageFilePath = origSelectedImageFileList.get(i);
if (isOrig) {
// 把原图按md5存放
String origMD5 = MD5.getStreamMD5(origImageFilePath);
String extension = FileUtil.getExtensionName(origImageFilePath);
String origMD5Path = StorageUtil.getWritePath(origMD5 + "." + extension,
StorageType.TYPE_IMAGE);
AttachmentStore.copy(origImageFilePath, origMD5Path);
// 把缩略图移到按原图计算的新md5目录下
String thumbFilename = FileUtil.getFileNameFromPath(imageFilepath);
String thumbMD5Path = StorageUtil.getReadPath(thumbFilename,
StorageType.TYPE_THUMB_IMAGE);
String origThumbMD5Path = StorageUtil.getWritePath(origMD5 + "." + extension,
StorageType.TYPE_THUMB_IMAGE);
AttachmentStore.move(thumbMD5Path, origThumbMD5Path);
if (callback != null) {
callback.sendImage(new File(origMD5Path), isOrig);
}
} else {
if (callback != null) {
callback.sendImage(imageFile, isOrig);
}
}
}
}