src/main/java/com/buschmais/jqassistant/plugin/common/api/scanner/MD5DigestDelegate.java
public <D extends MD5Descriptor> D digest(InputStream stream, DigestOperation<D> digestOperation) throws IOException {
        DigestInputStream digestInputStream = new DigestInputStream(stream, md5Digest);
        D md5Descriptor = digestOperation.execute(digestInputStream);
        String md5 = DatatypeConverter.printHexBinary(md5Digest.digest());
        md5Descriptor.setMd5(md5);
        return md5Descriptor;
    }
public <D extends MD5Descriptor> D digest(InputStream stream, DigestOperation<D> digestOperation) throws IOException {
        DigestInputStream digestInputStream = new DigestInputStream(stream, md5Digest);
        D md5Descriptor = digestOperation.execute(digestInputStream);
        String md5 = DatatypeConverter.printHexBinary(md5Digest.digest());
        md5Descriptor.setMd5(md5);
        return md5Descriptor;
    }
Calculate the MD5 hash sum for the given input stream using the given
operation.

@param stream
The stream.
@param digestOperation
The operation.
@param <D>
The MD5 descriptor type.
@return The MD5 descriptor.
@throws IOException
If reading the stream fails.