public ByteBuf consumeContentAsByteBuf() {
    synchronized (bufferLock) {
      if (compositeBuffer == null) {
        throw new IllegalStateException("Content already consumed or channel was closed.");
      }
      try {
        return compositeBuffer.asReadOnly();
      } finally {
        compositeBuffer = null;
      }
    }
  }
Consume the collected content buffer. This method or {@link #consumeContentAsInputStream()} can only be called
once since ownership of the content is transferred to the caller.
@return a {@link ByteBuf} that contains the data from the chunks received up to this point in time.
ambry-commons/src/main/java/com/github/ambry/commons/RetainingAsyncWritableChannel.java