ByteBuf.readBytes

Transfers this buffer's data to a newly created buffer starting at the current {@code readerIndex} and increases the {@code readerIndex} by the number of the transferred bytes (= {@code length}). The returned buffer's {@code readerIndex} and {@code writerIndex} are {@code 0} and {@code length} respectively.

@param length the number of bytes to transfer

@return the newly created buffer which contains the transferred bytes

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

Meta