code: public CompositeByteBuf consolidate() {
          ensureAccessible();
          final int numComponents = componentCount;
          if (numComponents <= 1) {
              return this;
          }
  
          final int capacity = components[numComponents - 1].endOffset;
          final ByteBuf consolidated = allocBuffer(capacity);
  
          for (int i = 0; i < numComponents; i ++) {
              components[i].transferTo(consolidated);
          }
          lastAccessed = null;
          components[0] = new Component(consolidated, 0, 0, capacity, consolidated);
          removeCompRange(1, numComponents);
          return this;
      }
docs: Consolidate the composed {@link ByteBuf}s