Java ByteBuffer Search indexOf(ByteBuffer buf, byte b)

Here you can find the source of indexOf(ByteBuffer buf, byte b)

Description

index Of

License

Apache License

Declaration

public static int indexOf(ByteBuffer buf, byte b) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.nio.ByteBuffer;

public class Main {
    public static int indexOf(ByteBuffer buf, byte b) {
        for (int i = 0; i < buf.remaining(); i++) {
            if (buf.get(buf.position() + i) == b) {
                return i;
            }/*from   w  w w  .j  a  v a 2s. com*/
        }
        return -1;
    }
}

Related

  1. binarySearch(ByteBuffer[] cells, ByteBuffer key, Comparator order)
  2. indexOf(ByteBuffer buf, byte value)
  3. indexOf(ByteBuffer buffer, byte b)
  4. indexOf(ByteBuffer buffer, ByteBuffer pattern)
  5. indexOf(ByteBuffer buffer, ByteBuffer pattern)