ByteBuf.bytesBefore

Locates the first occurrence of the specified {@code value} in this buffer. The search starts from the current {@code readerIndex} (inclusive) and lasts for the specified {@code length}. <p> This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer.

@return the number of bytes between the current {@code readerIndex} and the first occurrence if found. {@code -1} otherwise.

@throws IndexOutOfBoundsException if {@code length} is greater than {@code this.readableBytes}

  1. int bytesBefore(byte value)
  2. int bytesBefore(int length, byte value)
    class ByteBuf
    abstract
    int
    bytesBefore
    (
    int length
    ,
    byte value
    )
  3. int bytesBefore(int index, int length, byte value)

Meta