ByteBuf.retainedSlice

Returns a retained slice of this buffer's sub-region. Modifying the content of the returned buffer or this buffer affects each other's content while they maintain separate indexes and marks. This method does not modify {@code readerIndex} or {@code writerIndex} of this buffer. <p> Note that this method returns a {@linkplain #retain() retained} buffer unlike {@link #slice(int, int)}. This method behaves similarly to {@code slice(...).retain()} except that this method may return a buffer implementation that produces less garbage.

  1. ByteBuf retainedSlice()
  2. ByteBuf retainedSlice(int index, int length)
    class ByteBuf
    abstract
    retainedSlice
    (
    int index
    ,
    int length
    )

Meta