zoukankan      html  css  js  c++  java
  • md5

    // 获取文件MD5值
        public static String getMd5(File file) throws FileNotFoundException {
            String value = null;
            FileInputStream in = null;
            try {
                in = new FileInputStream(file);
                MappedByteBuffer byteBuffer = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length());
                MessageDigest md5 = MessageDigest.getInstance("MD5");
                md5.update(byteBuffer);
                BigInteger bi = new BigInteger(1, md5.digest());
                value = bi.toString(16);
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (null != in) {
                    try {
                        in.close();
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }
            }
            return value;
        }

  • 相关阅读:
    java 学习帮助
    权限
    ftp mybatis
    注解
    hadoop english
    userDao
    发布订阅模式 和委托
    webservice
    rabbitMq视频教程
    blog url.txt
  • 原文地址:https://www.cnblogs.com/wenwen123/p/5848051.html
Copyright © 2011-2022 走看看