org.apache.ivy.util

Class ChecksumHelper

public final class ChecksumHelper extends Object

Method Summary
static StringbyteArrayToHexString(byte[] in)
Convert a byte[] array to readable string format.
static voidcheck(File dest, File checksumFile, String algorithm)
Checks the checksum of the given file against the given checksumFile, and throws an IOException if the checksum is not compliant
static StringcomputeAsString(File f, String algorithm)
static booleanisKnownAlgorithm(String algorithm)

Method Detail

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

check

public static void check(File dest, File checksumFile, String algorithm)
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 whle reading files or if the checksum is not compliant

computeAsString

public static String computeAsString(File f, String algorithm)

isKnownAlgorithm

public static boolean isKnownAlgorithm(String algorithm)