code: public int indexOf(byte b) {
          if (_buf.hasArray()) {
              byte[] array = _buf.array();
              int arrayOffset = _buf.arrayOffset();
              int startAt = arrayOffset + position();
              int endAt = arrayOffset + limit();
  
              for (int i = startAt; i < endAt; i++) {
                  if (array[i] == b) {
                      return i - arrayOffset;
                  }
              }
              return -1;
          } else {
              int startAt = _buf.position();
              int endAt = _buf.limit();
  
              for (int i = startAt; i < endAt; i++) {
                  if (_buf.get(i) == b) {
                      return i;
                  }
              }
              return -1;
          }
      }
docs: Returns the index of the specified byte in the buffer.
  
  @param b
  the byte to find
  
  @return the index of the byte in the buffer, or -1 if not found