@Override
                                                          public ByteBuf cumulate(ByteBufAllocator alloc,
                                                                                  ByteBuf cumulation,
                                                                                  ByteBuf in) {
                                                              ByteBuf buffer;
                                                              if (cumulation.writerIndex() > cumulation
                                                                  .maxCapacity()
                                                                                             - in.readableBytes()
                                                                  || cumulation.refCnt() > 1) {
                                                                  // Expand cumulation (by replace it) when either there is not more room in the buffer
                                                                  // or if the refCnt is greater then 1 which may happen when the user use slice().retain() or
                                                                  // duplicate().retain().
                                                                  //
                                                                  // See:
                                                                  // - https://github.com/netty/netty/issues/2327
                                                                  // - https://github.com/netty/netty/issues/1764
                                                                  buffer = expandCumulation(alloc,
                                                                      cumulation,
                                                                      in.readableBytes());
                                                              } else {
                                                                  buffer = cumulation;
                                                              }
                                                              buffer.writeBytes(in);
                                                              in.release();
                                                              return buffer;
                                                          }
Cumulate {@link ByteBuf}s by merge them into one {@link ByteBuf}'s, using memory copies.
src/main/java/com/alipay/remoting/codec/AbstractBatchDecoder.java