Class ChecksumHelper

java.lang.Object
org.apache.ivy.util.ChecksumHelper

public final class ChecksumHelper extends Object
  • Field Details

    • BUFFER_SIZE

      private static final int BUFFER_SIZE
      See Also:
    • algorithms

      private static final Map<String,String> algorithms
    • CHARS

      private static final char[] CHARS
  • Constructor Details

    • ChecksumHelper

      private ChecksumHelper()
  • Method Details

    • isAlgorithmSupportedInJRE

      private static boolean isAlgorithmSupportedInJRE(String algorithm)
    • check

      public static void check(File dest, File checksumFile, String algorithm) throws IOException
      Checks the checksum of the given file against the given checksumFile, and throws an IOException if the checksum is not compliant
      Parameters:
      dest - the file to test
      checksumFile - the file containing the expected checksum
      algorithm - the checksum algorithm to use
      Throws:
      IOException - if an IO problem occur while reading files or if the checksum is not compliant
    • computeAsString

      public static String computeAsString(File f, String algorithm) throws IOException
      Throws:
      IOException
    • compute

      private static byte[] compute(File f, String algorithm) throws IOException
      Throws:
      IOException
    • isKnownAlgorithm

      public static boolean isKnownAlgorithm(String algorithm)
    • getMessageDigest

      private static MessageDigest getMessageDigest(String algorithm)
    • byteArrayToHexString

      public static String byteArrayToHexString(byte[] in)
      Convert a byte[] array to readable string format. This makes the "hex" readable!
      Parameters:
      in - byte[] buffer to convert to string format
      Returns:
      result String buffer in String format