Package software.amazon.awssdk.utils
Class Md5Utils
- java.lang.Object
-
- software.amazon.awssdk.utils.Md5Utils
-
public final class Md5Utils extends Object
Utility methods for computing MD5 sums.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
computeMD5Hash(byte[] input)
Computes the MD5 hash of the given data and returns it as an array of bytes.static byte[]
computeMD5Hash(File file)
Computes the MD5 of the given file.static byte[]
computeMD5Hash(InputStream is)
Computes the MD5 hash of the data in the given input stream and returns it as an array of bytes.static String
md5AsBase64(byte[] input)
Returns the MD5 in base64 for the given byte array.static String
md5AsBase64(File file)
Returns the MD5 in base64 for the given file.static String
md5AsBase64(InputStream is)
Returns the MD5 in base64 for the data from the given input stream.
-
-
-
Method Detail
-
computeMD5Hash
public static byte[] computeMD5Hash(InputStream is) throws 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:
IOException
-
md5AsBase64
public static String md5AsBase64(InputStream is) throws 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:
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 String md5AsBase64(byte[] input)
Returns the MD5 in base64 for the given byte array.
-
computeMD5Hash
public static byte[] computeMD5Hash(File file) throws FileNotFoundException, IOException
Computes the MD5 of the given file.- Throws:
FileNotFoundException
IOException
-
md5AsBase64
public static String md5AsBase64(File file) throws FileNotFoundException, IOException
Returns the MD5 in base64 for the given file.- Throws:
FileNotFoundException
IOException
-
-