管道基础大数据平台系统开发-【后端】-Server
13693261870
2022-12-30 4fb807515eba8d7e6e093e9a100fbbf9d4c81b99
src/main/java/com/lf/server/helper/FileHelper.java
@@ -197,9 +197,9 @@
    }
    /**
     * 获取文件 MD5 码
     * 获取文件MD5码(JDK)
     */
    public static String getFileMd5(String filePath) throws IOException {
    public static String getMd5ByJdk(String filePath) throws IOException {
        FileInputStream fileStream = new FileInputStream(filePath);
        String md5 = DigestUtils.md5Hex(fileStream);
        fileStream.close();
@@ -305,16 +305,16 @@
    /**
     * 获取文件的MD5
     * @param file
     * @param filePath
     * @return
     */
    @SuppressWarnings("unused")
    public static String getFileMd5(File file) {
    public static String getFileMd5(String filePath) {
        FileInputStream fis = null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            fis = new FileInputStream(file);
            fis = new FileInputStream(new File(filePath));
            FileChannel fChannel = fis.getChannel();
            ByteBuffer buffer = ByteBuffer.allocateDirect(1024 * 1024);