List of utility methods to do ByteBuffer Contain
boolean | contains(ByteBuffer buffer, byte b) contains return contains(buffer.array(), buffer.arrayOffset() + buffer.position(), buffer.remaining(), b);
|
boolean | contains(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) { ... |