org.apache.ivy.util
Class ChecksumHelper

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

public final class ChecksumHelper
extends java.lang.Object


Method Summary
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 compliant
static java.lang.String computeAsString(java.io.File f, java.lang.String algorithm)
           
static boolean isKnownAlgorithm(java.lang.String algorithm)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 test
checksumFile - the file containing the expected checksum
algorithm - the checksum algorithm to use
Throws:
java.io.IOException - if an IO problem occur whle 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