Package com.twmacinta.util

Examples of com.twmacinta.util.MD5InputStream


     */
    public static String getMD5Sum(String file) {

        byte[] buf = new byte[65536];

        MD5InputStream md5In = null;
        try {
            md5In = new MD5InputStream(new BufferedInputStream(new FileInputStream(file)));
            while (md5In.read(buf) != -1) {
                // do nothing?
            }

            return MD5.asHex(md5In.hash());
        }
        catch (IOException ioe) {
            logger.fatal("getMD5Sum() failed for file='" + file + "'", ioe);
            return "";
        }
        finally {
            try {
                if (md5In != null) {
                    md5In.close();
                }
            }
            catch (IOException ioe) {
                logger.fatal("getMD5Sum() can't close MD5InputStream", ioe);
            }
View Full Code Here

TOP

Related Classes of com.twmacinta.util.MD5InputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.