1 22 package org.objectweb.petals.util; 23 24 import java.io.File ; 25 import java.io.IOException ; 26 import java.net.URI ; 27 28 import com.twmacinta.util.MD5; 29 30 35 public final class MD5SumCalculator { 36 37 private MD5SumCalculator() { 38 } 40 41 48 public static String calculateMD5Sum(URI archiveURI) 49 throws PetalsRuntimeException { 50 51 String hash = null; 52 try { 53 hash = MD5.asHex(MD5.getHash(new File (archiveURI))); 54 } catch (IOException e) { 55 String msg = "Error when calculating MD5 sum of the archive : " 56 + archiveURI + "."; 57 throw new PetalsRuntimeException(msg, e); 58 } 59 return hash; 60 } 61 62 } 63 | Popular Tags |