Class Utils


  • public class Utils
    extends Object
    • Constructor Detail

      • Utils

        public Utils()
    • 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.
      • getHash

        public static String getHash​(String input)
        Generates an MD5 hash for the given input string.
        Parameters:
        input - The input string to hash.
        Returns:
        The MD5 hash as a hexadecimal string, or null if the algorithm is not available.