code: public CompositeByteBuf consolidate(int cIndex, int numComponents) {
          checkComponentIndex(cIndex, numComponents);
          if (numComponents <= 1) {
              return this;
          }
  
          final int endCIndex = cIndex + numComponents;
          final Component last = components[endCIndex - 1];
          final int capacity = last.endOffset - components[cIndex].offset;
          final ByteBuf consolidated = allocBuffer(capacity);
  
          for (int i = cIndex; i < endCIndex; i ++) {
              components[i].transferTo(consolidated);
          }
          lastAccessed = null;
          removeCompRange(cIndex + 1, endCIndex);
          components[cIndex] = new Component(consolidated, 0, 0, capacity, consolidated);
          updateComponentOffsets(cIndex);
          return this;
      }
docs: Consolidate the composed {@link ByteBuf}s
  
  @param cIndex the index on which to start to compose
  @param numComponents the number of components to compose