|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.MD5
public class MD5
A class that does MD5 checksumming We don't want everybody to have to do MessageDigest.getInstance() and hex conversion.
Field Summary | |
---|---|
(package private) static int |
MAGIC_INTEGER_4
|
(package private) static int |
MAGIC_INTEGER_OxOF
|
Constructor Summary | |
---|---|
MD5()
|
Method Summary | |
---|---|
static java.lang.String |
generateMD5(byte[] msg)
Generate an MD5 for a byte array. |
static java.lang.String |
generateMD5(java.io.InputStream instream)
Generates an MD5 on an InputStream, throwing away the data itself. |
static java.lang.String |
generateMD5onFile(java.io.File file)
Generates an MD5 on a given file. |
static java.security.MessageDigest |
getMessageDigestInstance()
Return na MD5 MessageDigest object. |
static java.lang.String |
toHex(byte[] ba)
Converts a byte array to a hexstring. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final int MAGIC_INTEGER_4
static final int MAGIC_INTEGER_OxOF
Constructor Detail |
---|
public MD5()
Method Detail |
---|
public static java.security.MessageDigest getMessageDigestInstance()
public static java.lang.String generateMD5(byte[] msg)
msg
- The given bytearray
public static java.lang.String generateMD5onFile(java.io.File file) throws java.io.IOException, java.io.FileNotFoundException
file
- Unique reference to file for which to generate checksum
java.io.IOException
java.io.FileNotFoundException
public static java.lang.String generateMD5(java.io.InputStream instream)
instream
- An inputstream to generate MD5 on. The contents of
the stream will be consumed by this call, but the stream will not
be closed.
IOFailure
- if there is an error reading from the streampublic static java.lang.String toHex(byte[] ba)
ba
- the bytearray to be converted
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |