Java Utililty Methods ByteBuffer Contain

List of utility methods to do ByteBuffer Contain

Description

The list of methods to do ByteBuffer Contain are organized into topic(s).

Method

booleancontains(ByteBuffer buffer, byte b)
contains
return contains(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining(), b);
booleancontains(ByteBuffer buffer, ByteBuffer subBuffer)
Check is the given buffer contains a given sub-buffer.
int len = subBuffer.remaining();
if (buffer.remaining() - len < 0)
    return false;
byte first = subBuffer.get(subBuffer.position());
int max = buffer.position() + (buffer.remaining() - len);
for (int i = buffer.position(); i <= max; i++) {
    if (buffer.get(i) != first) {
        while (++i <= max && buffer.get(i) != first) {
...