From 6fc4af57d22780cf9809c5bcd4ad8a7ee815d2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AF=9B=E6=AF=9B=E8=99=AB?= <1421374934@qq.com> Date: Wed, 12 Jan 2022 22:09:29 +0800 Subject: [PATCH] :bug: add test md5 --- .../com/rymcu/forest/utils/TestFileMd5.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/java/com/rymcu/forest/utils/TestFileMd5.java diff --git a/src/test/java/com/rymcu/forest/utils/TestFileMd5.java b/src/test/java/com/rymcu/forest/utils/TestFileMd5.java new file mode 100644 index 0000000..5a5f2be --- /dev/null +++ b/src/test/java/com/rymcu/forest/utils/TestFileMd5.java @@ -0,0 +1,26 @@ +package com.rymcu.forest.utils; + +import org.junit.jupiter.api.Test; +import org.springframework.util.DigestUtils; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +public class TestFileMd5 { + + /** + * c6c26c7e8a5eb493b14e84bd91df60e3 + * d41d8cd98f00b204e9800998ecf8427e + * + * @throws Exception + */ + @Test + public void test() throws Exception { + String pathName = "E:\\1.txt"; + InputStream inputStream = new FileInputStream(new File(pathName)); + String md5 = DigestUtils.md5DigestAsHex((inputStream)); + System.err.println(md5); + System.err.println(md5.length()); + } +}