⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 codecutils.java

📁 一些公用的Java函数
💻 JAVA
字号:
/* * CodecUtils.java *  * Created on 2007-11-5, 11:04:09 *  * To change this template, choose Tools | Templates * and open the template in the editor. */package com.s7turn.sdk.utils;import java.io.IOException;import java.io.InputStream;import java.io.ByteArrayOutputStream;import org.apache.commons.codec.binary.Hex;import org.apache.commons.codec.digest.DigestUtils;import com.s7turn.logging.Logger;/** * * @author Long */public class CodecUtils {        public static String md5( byte[] buffer )    {        return DigestUtils.md5Hex(buffer);    }        public static String md5( InputStream input )    {        ByteArrayOutputStream baos = new ByteArrayOutputStream();        byte[] buffer = new byte[10240];        int readed = 0;        try{            do{                readed = input.read(buffer, 0, 10240);                if (readed > 0)                    baos.write(buffer, 0, readed);            }while( readed > 0 );        }        catch (IOException ex)        {            Logger.getLogger().debug("Exception %s.\n", ex);        }        finally        {            try{                baos.close();            }catch(Exception ex){}        }          buffer = baos.toByteArray();                return md5( buffer );    }                }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -