net-commonlib/src/main/java/com/streamsets/pipeline/lib/parser/net/DelimitedLengthFieldBasedFrameDecoder.java
protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length) {
    return buffer.slice(index, length).retain();
  }
protected ByteBuf extractFrame(ChannelHandlerContext ctx, ByteBuf buffer, int index, int length) {
    return buffer.slice(index, length).retain();
  }
Extract the sub-region of the specified buffer.
<p>
If you are sure that the frame and its content are not accessed after
the current {@link #decode(ChannelHandlerContext, ByteBuf)}
call returns, you can even avoid memory copy by returning the sliced
sub-region (i.e. <tt>return buffer.slice(index, length)</tt>).
It's often useful when you convert the extracted frame into an object.
Refer to the source code of {@link ObjectDecoder} to see how this method
is overridden to avoid memory copy.