Class ArmeriaMessageFramer

  • All Implemented Interfaces:
    AutoCloseable

    public class ArmeriaMessageFramer
    extends Object
    implements AutoCloseable
    A framer of messages for transport with the gRPC wire protocol. See gRPC Wire Protocol for more detail on the protocol.

    The logic has mostly been copied from io.grpc.internal.MessageFramer, while removing the buffer abstraction in favor of using ByteBuf directly. The code has been vastly simplified due to the lack of support for arbitrary InputStreams.

    • Field Detail

      • NO_MAX_OUTBOUND_MESSAGE_SIZE

        public static final int NO_MAX_OUTBOUND_MESSAGE_SIZE
        See Also:
        Constant Field Values
    • Constructor Detail

      • ArmeriaMessageFramer

        public ArmeriaMessageFramer​(ByteBufAllocator alloc,
                                    int maxOutboundMessageSize)
        Constructs an ArmeriaMessageFramer to write messages to a gRPC request or response.
    • Method Detail

      • writePayload

        public com.linecorp.armeria.unsafe.ByteBufHttpData writePayload​(ByteBuf message)
        Writes out a payload message.
        Parameters:
        message - the message to be written out. Ownership is taken by ArmeriaMessageFramer.
        Returns:
        a ByteBufHttpData with the framed payload. Ownership is passed to caller.
      • setMessageCompression

        public void setMessageCompression​(boolean messageCompression)
      • setCompressor

        public void setCompressor​(@Nullable
                                  Compressor compressor)
      • isClosed

        public boolean isClosed()
        Indicates whether or not this framer has been closed via a call to either close().