Class MessageFramer
java.lang.Object
io.grpc.internal.MessageFramer
- All Implemented Interfaces:
Framer
Encodes gRPC messages to be delivered via the transport layer which implements
MessageFramer.Sink.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSink implemented by the transport layer to receive frames and forward them to their destination. -
Constructor Summary
ConstructorsConstructorDescriptionMessageFramer(MessageFramer.Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx) Creates aMessageFramer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flushes and closes the framer and releases any buffers.voiddispose()Closes the framer and releases any buffers, but does not flush.voidflush()Flushes any buffered data in the framer to the sink.booleanisClosed()setCompressor(Compressor compressor) Set the compressor used for compression.voidsetMaxOutboundMessageSize(int maxSize) Set a size limit for each outbound message.setMessageCompression(boolean enable) Enable or disable compression.voidwritePayload(InputStream message) Writes out a payload message.
-
Constructor Details
-
MessageFramer
public MessageFramer(MessageFramer.Sink sink, WritableBufferAllocator bufferAllocator, StatsTraceContext statsTraceCtx) Creates aMessageFramer.- Parameters:
sink- the sink used to deliver frames to the transportbufferAllocator- allocates buffers that the transport can commit to the wire.
-
-
Method Details
-
setCompressor
Description copied from interface:FramerSet the compressor used for compression.- Specified by:
setCompressorin interfaceFramer
-
setMessageCompression
Description copied from interface:FramerEnable or disable compression.- Specified by:
setMessageCompressionin interfaceFramer
-
setMaxOutboundMessageSize
public void setMaxOutboundMessageSize(int maxSize) Description copied from interface:FramerSet a size limit for each outbound message.- Specified by:
setMaxOutboundMessageSizein interfaceFramer
-
writePayload
Writes out a payload message.- Specified by:
writePayloadin interfaceFramer- Parameters:
message- contains the message to be written out. It will be completely consumed.
-
flush
-
isClosed
-
close
-
dispose
-