Package org.wso2.maven.datamapper
Class Utils
- java.lang.Object
-
- org.wso2.maven.datamapper.Utils
-
public class Utils extends Object
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringconvertToHex(byte[] messageDigest)Converts a byte array into a hexadecimal string.static StringgetFileChecksum(Path filePath)Calculates the MD5 checksum of the specified file.static StringgetHash(String input)Generates an MD5 hash for the given input string.
-
-
-
Method Detail
-
convertToHex
public static String convertToHex(byte[] messageDigest)
Converts a byte array into a hexadecimal string. Pads the result with leading zeros to ensure a length of 32 characters.- Parameters:
messageDigest- The byte array to convert.- Returns:
- The hexadecimal string representation.
-
getFileChecksum
public static String getFileChecksum(Path filePath) throws DataMapperException
Calculates the MD5 checksum of the specified file.- Parameters:
filePath- The path to the file for which the checksum is to be calculated.- Returns:
- The MD5 checksum as a hexadecimal string.
- Throws:
DataMapperException- if an I/O error or algorithm error occurs during checksum calculation.
-
-