Class MessageFramer

java.lang.Object
io.grpc.internal.MessageFramer
All Implemented Interfaces:
Framer

public class MessageFramer extends Object implements Framer
Encodes gRPC messages to be delivered via the transport layer which implements MessageFramer.Sink.
  • Constructor Details

    • MessageFramer

      public MessageFramer(MessageFramer.Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx)
      Creates a MessageFramer.
      Parameters:
      sink - the sink used to deliver frames to the transport
      bufferAllocator - allocates buffers that the transport can commit to the wire.
  • Method Details

    • setCompressor

      public MessageFramer setCompressor(Compressor compressor)
      Description copied from interface: Framer
      Set the compressor used for compression.
      Specified by:
      setCompressor in interface Framer
    • setMessageCompression

      public MessageFramer setMessageCompression(boolean enable)
      Description copied from interface: Framer
      Enable or disable compression.
      Specified by:
      setMessageCompression in interface Framer
    • setMaxOutboundMessageSize

      public void setMaxOutboundMessageSize(int maxSize)
      Description copied from interface: Framer
      Set a size limit for each outbound message.
      Specified by:
      setMaxOutboundMessageSize in interface Framer
    • writePayload

      public void writePayload(InputStream message)
      Writes out a payload message.
      Specified by:
      writePayload in interface Framer
      Parameters:
      message - contains the message to be written out. It will be completely consumed.
    • flush

      public void flush()
      Flushes any buffered data in the framer to the sink.
      Specified by:
      flush in interface Framer
    • isClosed

      public boolean isClosed()
      Indicates whether or not this framer has been closed via a call to either close() or dispose().
      Specified by:
      isClosed in interface Framer
    • close

      public void close()
      Flushes and closes the framer and releases any buffers. After the framer is closed or disposed, additional calls to this method will have no affect.
      Specified by:
      close in interface Framer
    • dispose

      public void dispose()
      Closes the framer and releases any buffers, but does not flush. After the framer is closed or disposed, additional calls to this method will have no affect.
      Specified by:
      dispose in interface Framer