On 22/11/2011 23:26, Xueming Shen wrote:
Hi,
java.util.zip.Adler32/CRC32 do not have update method that accepts
ByteBuffer.
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
performance
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
http://cr.openjdk.java.net/~sherman/7109837/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).
-Alan.