[ 
https://issues.apache.org/jira/browse/CODEC-220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15288898#comment-15288898
 ] 

Sebb commented on CODEC-220:
----------------------------

The current API looks like:

byte [] digest DigestUtils.md2(new File("pom.xml")); // for defined digest types

byte [] digest DigestUtils.digest(DigestUtils.getDigest("NEW-1"), new 
File("pom.xml")); // for other digest types

or, if we added new static digest methods supporting Strings it could look like:
byte [] digest DigestUtils.digest("NEW-1", new File("pom.xml")); // for other 
digest types

This is closer to the fluent style.




> Possible more OO-like approach to DigestUtils
> ---------------------------------------------
>
>                 Key: CODEC-220
>                 URL: https://issues.apache.org/jira/browse/CODEC-220
>             Project: Commons Codec
>          Issue Type: Improvement
>            Reporter: Sebb
>         Attachments: MessageDigestHelper.java, MessageDigestHelper.java
>
>
> DigestUtils is starting to get a bit unwieldy with so many similar static 
> methods.
> One approach would be to use a Fluent approach (method chaining).
> e.g. DigestUtils.MDA("My-Digest").digestHex(File f);
> There would only need to be digest,digestHex and update instance methods for 
> the different input types, currently byte, ByteBuffer, InputStream, File.
> Whereas at present these are repeated for each digest type.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to