org.broadinstitute.gatk.utils.Utils.calcMD5()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(180)

本文整理了Java中org.broadinstitute.gatk.utils.Utils.calcMD5()方法的一些代码示例,展示了Utils.calcMD5()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.calcMD5()方法的具体详情如下:
包路径:org.broadinstitute.gatk.utils.Utils
类名称:Utils
方法名:calcMD5

Utils.calcMD5介绍

暂无

代码示例

代码示例来源:origin: broadgsa/gatk

/**
 * @see #calcMD5(byte[])
 */
public static String calcMD5(final String s) {
  return calcMD5(s.getBytes());
}

代码示例来源:origin: broadgsa/gatk

@Test
public void testCalcMD5() throws Exception {
  final File source = new File(publicTestDir + "exampleFASTA.fasta");
  final String sourceMD5 = "36880691cf9e4178216f7b52e8d85fbe";
  final byte[] sourceBytes = IOUtils.readFileIntoByteArray(source);
  Assert.assertEquals(Utils.calcMD5(sourceBytes), sourceMD5);
  final String sourceString = FileUtils.readFileToString(source);
  Assert.assertEquals(Utils.calcMD5(sourceString), sourceMD5);
}

代码示例来源:origin: broadgsa/gatk

/**
 * Calculates the MD5 for the specified file and returns it as a String
 *
 * @param file file whose MD5 to calculate
 * @return file's MD5 in String form
 * @throws RuntimeException if the file could not be read
 */
public String calculateFileMD5( final File file ) {
  try {
    return Utils.calcMD5(getBytesFromFile(file));
  }
  catch ( Exception e ) {
    throw new RuntimeException("Failed to read bytes from file: " + file + " for MD5 calculation", e);
  }
}

相关文章