What's the easiest way in Java to compare the contents of two ByteBuffers to check for equality?
You could check the equals()
method too.
Tells whether or not this buffer is equal to another object.
Two byte buffers are equal if, and only if,
- They have the same element type,
- They have the same number of remaining elements, and
- The two sequences of remaining elements, considered independently of their starting positions, are pointwise equal.
A byte buffer is not equal to any other type of object.