Skip to content

Commit

Permalink
prepare new major release in version 3
Browse files Browse the repository at this point in the history
- javadoc added
  • Loading branch information
astrapi69 committed Dec 22, 2023
1 parent 615d0b3 commit afad5ea
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/io/github/astrapi69/checksum/DirectoryChecksum.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,46 @@
import java.security.NoSuchAlgorithmException;
import java.util.Objects;

/**
* The class {@link DirectoryChecksum} provides algorithms for computing checksum for directories
*
* @author Asterios Raptis
* @version 1.0
*/
public class DirectoryChecksum
{

/**
* The {@link MessageDigest} object
*/
MessageDigest messageDigest;

/**
* Instantiates a new {@link DirectoryChecksum} object
*
* @param algorithm
* the algorithm for the {@link MessageDigest} object
* @throws NoSuchAlgorithmException
* Is thrown if the algorithm is not supported or does not exists
* {@link MessageDigest} object
*/
DirectoryChecksum(String algorithm) throws NoSuchAlgorithmException
{
Objects.requireNonNull(algorithm, "Given algorithm is null");
this.messageDigest = MessageDigest.getInstance(algorithm);
this.messageDigest.reset();
}

/**
* Updates the digest using the specified array of bytes and return the result as hexadecimal
* {@link String} object
*
* @param dirPath
* the directory path
* @return the hexadecimal {@link String} object
* @throws IOException
* Signals that an I/O exception has occurred
*/
public String update(Path dirPath) throws IOException
{
Files.newDirectoryStream(dirPath).forEach(currentFile -> {
Expand Down

0 comments on commit afad5ea

Please sign in to comment.