com.amazonaws.util
Class Md5Utils

java.lang.Object
  extended by com.amazonaws.util.Md5Utils

public class Md5Utils
extends java.lang.Object

Utility methods for computing MD5 sums.


Constructor Summary
Md5Utils()
           
 
Method Summary
static byte[] computeMD5Hash(byte[] input)
          Computes the MD5 hash of the given data and returns it as an array of bytes.
static byte[] computeMD5Hash(java.io.File file)
          Computes the MD5 of the given file.
static byte[] computeMD5Hash(java.io.InputStream is)
          Computes the MD5 hash of the data in the given input stream and returns it as an array of bytes.
static java.lang.String md5AsBase64(byte[] input)
          Returns the MD5 in base64 for the given byte array.
static java.lang.String md5AsBase64(java.io.File file)
          Returns the MD5 in base64 for the given file.
static java.lang.String md5AsBase64(java.io.InputStream is)
          Returns the MD5 in base64 for the data from the given input stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Md5Utils

public Md5Utils()
Method Detail

computeMD5Hash

public static byte[] computeMD5Hash(java.io.InputStream is)
                             throws java.io.IOException
Computes the MD5 hash of the data in the given input stream and returns it as an array of bytes. Note this method closes the given input stream upon completion.

Throws:
java.io.IOException

md5AsBase64

public static java.lang.String md5AsBase64(java.io.InputStream is)
                                    throws java.io.IOException
Returns the MD5 in base64 for the data from the given input stream. Note this method closes the given input stream upon completion.

Throws:
java.io.IOException

computeMD5Hash

public static byte[] computeMD5Hash(byte[] input)
Computes the MD5 hash of the given data and returns it as an array of bytes.


md5AsBase64

public static java.lang.String md5AsBase64(byte[] input)
Returns the MD5 in base64 for the given byte array.


computeMD5Hash

public static byte[] computeMD5Hash(java.io.File file)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Computes the MD5 of the given file.

Throws:
java.io.FileNotFoundException
java.io.IOException

md5AsBase64

public static java.lang.String md5AsBase64(java.io.File file)
                                    throws java.io.FileNotFoundException,
                                           java.io.IOException
Returns the MD5 in base64 for the given file.

Throws:
java.io.FileNotFoundException
java.io.IOException


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.