code: public static ByteBuf getByteBufFromReadableBuffer(ReadableBuffer buffer) {
      if (!sZeroCopyReceiveSupported) {
        return null;
      }
      try {
        if (buffer instanceof CompositeReadableBuffer) {
          Queue<ReadableBuffer> buffers = (Queue<ReadableBuffer>) sCompositeBuffers.get(buffer);
          if (buffers.size() == 1) {
            return getByteBufFromReadableBuffer(buffers.peek());
          } else {
            CompositeByteBuf buf = PooledByteBufAllocator.DEFAULT.compositeBuffer();
            for (ReadableBuffer readableBuffer : buffers) {
              ByteBuf subBuffer = getByteBufFromReadableBuffer(readableBuffer);
              if (subBuffer == null) {
                return null;
              }
              buf.addComponent(true, subBuffer);
            }
            return buf;
          }
        } else if (buffer.getClass().equals(sReadableByteBuf.getDeclaringClass())) {
          return (ByteBuf) sReadableByteBuf.get(buffer);
        }
      } catch (Exception e) {
        LOG.warn("Failed to get data buffer from stream: {}.", e.getMessage());
        return null;
      }
      return null;
    }
docs: Gets a Netty buffer directly from a gRPC ReadableBuffer.
  
  @param buffer the input buffer
  @return the raw ByteBuf, or null if the ByteBuf cannot be extracted