Package org.apache.ivy.util
Class ChecksumHelper
java.lang.Object
org.apache.ivy.util.ChecksumHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final char[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
byteArrayToHexString
(byte[] in) Convert a byte[] array to readable string format.static void
Checks the checksum of the given file against the given checksumFile, and throws an IOException if the checksum is not compliantprivate static byte[]
static String
computeAsString
(File f, String algorithm) private static MessageDigest
getMessageDigest
(String algorithm) private static boolean
isAlgorithmSupportedInJRE
(String algorithm) static boolean
isKnownAlgorithm
(String algorithm)
-
Field Details
-
BUFFER_SIZE
private static final int BUFFER_SIZE- See Also:
-
algorithms
-
CHARS
private static final char[] CHARS
-
-
Constructor Details
-
ChecksumHelper
private ChecksumHelper()
-
-
Method Details
-
isAlgorithmSupportedInJRE
-
check
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:
IOException
- if an IO problem occur while reading files or if the checksum is not compliant
-
computeAsString
- Throws:
IOException
-
compute
- Throws:
IOException
-
isKnownAlgorithm
-
getMessageDigest
-
byteArrayToHexString
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
-