com.zeroturnaround.liverebel.util
Class MD5CheckSum
java.lang.Object
com.zeroturnaround.liverebel.util.MD5CheckSum
public class MD5CheckSum
- extends Object
MD5CheckSum calculator
- Author:
- Ats Uiboupin
|
Method Summary |
static String |
md5Hex(File file)
Calculates the MD5 digest and returns the value as a 32 character hex string. |
static String |
md5Hex(InputStream in)
|
static String |
md5Hex(InputStream originalInStream,
MD5CheckSum.InputStreamCallback inputStreamCallback)
Convenience method that calculates MD5 checksum based on inputStream while still allowing other code to consume
same data from input stream given by inputStreamCallback.
MD5CheckSum.MD5ReaderThread consumes originalInStream to calculate MD5 checksum based on it, but it writes
all original bytes to pipedOutStream that is made available as InputStream to the
inputStreamCallback which can handle given
input stream as if it would read originalInStream |
static String |
md5Hex(InputStream inStream,
OutputStream outStream)
calculates MD5 checksum based on inStream and writes bytes read to outStream. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MD5CheckSum
public MD5CheckSum()
md5Hex
public static String md5Hex(File file)
- Calculates the MD5 digest and returns the value as a 32 character hex string.
- Parameters:
file - file to digest.
- Returns:
- MD5 digest as a hex string.
md5Hex
public static String md5Hex(InputStream in)
throws IOException
- Throws:
IOException
md5Hex
public static String md5Hex(InputStream inStream,
OutputStream outStream)
throws IOException
- calculates MD5 checksum based on
inStream and writes bytes read to outStream. Both
streams will be closed.
- Parameters:
inStream - outStream -
- Returns:
- MD5 checksum
- Throws:
IOException
md5Hex
public static String md5Hex(InputStream originalInStream,
MD5CheckSum.InputStreamCallback inputStreamCallback)
throws IOException
- Convenience method that calculates MD5 checksum based on inputStream while still allowing other code to consume
same data from input stream given by
inputStreamCallback.
MD5CheckSum.MD5ReaderThread consumes originalInStream to calculate MD5 checksum based on it, but it writes
all original bytes to pipedOutStream that is made available as InputStream to the
inputStreamCallback which can handle given
input stream as if it would read originalInStream
- Parameters:
originalInStream - inputStreamCallback - - used to perform custom action with the data available from
originalInStream
- Returns:
- MD5 checksum
- Throws:
IOException
Copyright © 2013. All Rights Reserved.