Class AddWritableBuffer


public class AddWritableBuffer extends Object
Allow a user to add a ByteBuf based InputStream directly into GRPC WritableBuffer to avoid an extra copy. This could be solved in GRPC by adding a ByteBufListable interface on InputStream and letting BufferChainOutputStream take advantage of it.
  • Constructor Details

    • AddWritableBuffer

      public AddWritableBuffer()
  • Method Details

    • add

      public static boolean add(io.netty.buffer.ByteBuf buf, OutputStream stream, boolean tryZeroCopy) throws IOException
      Add the provided ByteBuf to the gRPC BufferChainOutputStream if possible, else copy the buffer to the stream.
      buf - The buffer to add.
      stream - The Candidate OutputStream to add to.
      tryZeroCopy - If true, try to zero-copy append the buffer to the stream. This may not succeed.
      True if buffer was zero-copy added to the stream. False if the buffer was copied.
      IOException - if the fast path is not enabled and there was an error copying the buffer to the stream.