Class ChecksumValidator

java.lang.Object
io.github.rajendarreddyj.tomcat.download.ChecksumValidator

public class ChecksumValidator extends Object
Validates file integrity using SHA-512 checksums.
Since:
1.0.0
Author:
rajendarreddyj
  • Constructor Details

    • ChecksumValidator

      public ChecksumValidator()
  • Method Details

    • validate

      public boolean validate(Path file, String checksumUrl) throws IOException
      Validates file checksum against remote SHA-512 file.
      Parameters:
      file - The file to validate
      checksumUrl - URL to the .sha512 checksum file
      Returns:
      true if checksum matches, false otherwise
      Throws:
      IOException - if checksum cannot be read or calculated
    • calculateChecksum

      public String calculateChecksum(Path file) throws IOException
      Calculates SHA-512 checksum of a file.
      Parameters:
      file - the file to calculate checksum for
      Returns:
      the hex-encoded checksum
      Throws:
      IOException - if file cannot be read or algorithm unavailable