Class Hasher
java.lang.Object
org.apache.maven.plugins.enforcer.Hasher
Utility class to generate hashes/checksums for binary files.
Typically used to generate a hashes for .class files to compare
those files for equality.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
generateHash
(org.apache.maven.artifact.Artifact artifact) private String
hashForFileInDirectory
(File artifactFile) private String
hashForFileInJar
(File artifactFile)
-
Field Details
-
classFilePath
the path to the .class file. Example: org/apache/maven/Stuff.class
-
-
Constructor Details
-
Hasher
Constructor.- Parameters:
classFilePath
- The path to the .class file. This is the file we'll generate a hash for. Example: org/apache/maven/Stuff.class
-
-
Method Details
-
generateHash
- Parameters:
artifact
- The artifact (example: jar file) which contains theclassFilePath
. We'll generate a hash for the class file inside this artifact.- Returns:
- generate a hash/checksum for the .class file in the provided artifact.
-
hashForFileInDirectory
- Throws:
IOException
-
hashForFileInJar
- Throws:
IOException
-
closeAll
- Throws:
IOException
-