Interface HashUtils

All Known Implementing Classes:
HashUtilsImpl

public interface HashUtils
  • Method Details

    • hash

      @Nullable String hash(File file, HashAlgorithm algorithm)
      Get the hash for a given file.
      Parameters:
      file - - File
      algorithm - - HashAlgorithm
      Returns:
      String or null if the file didn't exist or issues occurred reading it.
    • createChecksumFile

      @Nullable File createChecksumFile(File file, HashAlgorithm algorithm)
      Creates a checksum file for a given file. The hash file will be created alongside the given file in the same parent directory. Example the the file /test/1.0.jar, after calling this method with, for example HashAlgorithm.SHA512, have alongside itself the file /test/1.0.jar.sha512
      Parameters:
      file - - File
      algorithm - - HashAlgorithm
      Returns:
      File - the File with the hash for the given file, or null if unable to create it.
    • isChecksumFile

      boolean isChecksumFile(File file)
      Test whether a given File is a file that is considered a checksum file based on its extension ending with HashAlgorithm.MD5, HashAlgorithm.SHA1,HashAlgorithm.SHA256 or HashAlgorithm.SHA512.
      Parameters:
      file - - File
      Returns:
      true if the given file is considered a checksum file.
    • isSignatureFile

      boolean isSignatureFile(File file)
      Test whether a given File is a file that is considered a signature file with .asc extension
      Parameters:
      file - - File
      Returns:
      true if the given file is considered a signature file