public default void update (ByteBuffer buffer)

Updates the current checksum with the bytes from the specified buffer. The checksum is updated with the remaining bytes in the buffer, starting at the buffer's position. Upon return, the buffer's position will be updated to its limit; its limit will not have been changed.

Parameters:
buffer    the ByteBuffer to update the checksum with

Exceptions:
NullPointerException     if buffer is null

Since:  9

@apiNote For best performance with DirectByteBuffer and other ByteBuffer implementations without a backing array implementers of this interface should override this method.
@implSpec The default implementation has the following behavior.
For ByteBuffers backed by an accessible byte array.


 update(buffer.array(),
        buffer.position() + buffer.arrayOffset(),
        buffer.remaining());
 
For ByteBuffers not backed by an accessible byte array.

 byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
 while (buffer.hasRemaining()) {
     int length = Math.min(buffer.remaining(), b.length);
     buffer.get(b, 0, length);
     update(b, 0, length);
 
 }