Codereview request: 7109837 Provide a mechanism for computing an Adler32 checksum for the contents of a ByteBuffer
Alan.Bateman at oracle.com
Wed Nov 23 02:58:06 PST 2011
On 22/11/2011 23:26, Xueming Shen wrote:
> java.util.zip.Adler32/CRC32 do not have update method that accepts
> As of JDK7, you have to copy the content of the ByteBuffer into a
> byte, then
> invoke Adler32/CRC32.update() method, which might have significant
> impact for some applications. Here I'm proposing to add two update
> methods in
> j.u.z.Adler32 and CRC32 classes respectively to address this issue.
> Here is the webrev
I think the method descriptions could be do with a bit more polish. For
example you could link to the remaining, position, and limit methods.
The javadoc could also say that the check sum is not updated if there
are no bytes remaining. Neither class specifies how nulls are handled so
you could add a statement to the class description to make it clear that
NPE is thrown (no need to do this for every method).
The test looks good but I don't think it's testing that the buffer
position and limit after the calls to update(ByteBuffer).
More information about the core-libs-dev