Package org.apache.ivy.util
Class ChecksumHelper
- java.lang.Object
-
- org.apache.ivy.util.ChecksumHelper
-
public final class ChecksumHelper extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
byteArrayToHexString(byte[] in)
Convert a byte[] array to readable string format.static void
check(java.io.File dest, java.io.File checksumFile, java.lang.String algorithm)
Checks the checksum of the given file against the given checksumFile, and throws an IOException if the checksum is not compliantstatic java.lang.String
computeAsString(java.io.File f, java.lang.String algorithm)
static boolean
isKnownAlgorithm(java.lang.String algorithm)
-
-
-
Method Detail
-
check
public static void check(java.io.File dest, java.io.File checksumFile, java.lang.String algorithm) throws java.io.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 testchecksumFile
- the file containing the expected checksumalgorithm
- the checksum algorithm to use- Throws:
java.io.IOException
- if an IO problem occur while reading files or if the checksum is not compliant
-
computeAsString
public static java.lang.String computeAsString(java.io.File f, java.lang.String algorithm) throws java.io.IOException
- Throws:
java.io.IOException
-
isKnownAlgorithm
public static boolean isKnownAlgorithm(java.lang.String algorithm)
-
byteArrayToHexString
public static java.lang.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
-
-