Ejemplo n.º 1
0
  public static long checksumBufferedInputStream(Path filename) throws IOException {
    try (InputStream in = new BufferedInputStream(Files.newInputStream(filename))) {
      CRC32 crc = new CRC32();

      int c;
      while ((c = in.read()) != -1) crc.update(c);
      return crc.getValue();
    }
  }