slash.common.io.Files.generateChecksum()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(151)

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

Files.generateChecksum介绍

暂无

代码示例

代码示例来源:origin: cpesch/RouteConverter

public static String generateChecksum(File file) throws IOException {
  try (InputStream inputStream = new FileInputStream(file)) {
    return generateChecksum(inputStream);
  }
}

代码示例来源:origin: cpesch/RouteConverter

public static Checksum createChecksum(File file) throws IOException {
  return file != null && file.exists() ?
      new Checksum(fromMillis(roundMillisecondsToSecondPrecision(file.lastModified())), file.length(), generateChecksum(file)) : null;
}

代码示例来源:origin: cpesch/RouteConverter

return fragment.getDownloadable();
String sha1 = generateChecksum(file);

代码示例来源:origin: cpesch/RouteConverter

private static ChecksumType createChecksumType(Long lastModified, Long contentLength, InputStream inputStream) throws IOException {
  ChecksumType result = new ChecksumType();
  result.setLastModified(lastModified != null ? formatXMLTime(fromMillis(lastModified), true) : null);
  result.setContentLength(contentLength);
  if (inputStream != null)
    result.setSha1(generateChecksum(inputStream));
  return result;
}

相关文章