Package io.grpc.internal
Class MessageDeframer
java.lang.Object
io.grpc.internal.MessageDeframer
- All Implemented Interfaces:
Deframer
,Closeable
,AutoCloseable
Deframer for GRPC frames.
This class is not thread-safe. Unless otherwise stated, all calls to public methods should be made in the deframing thread.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A listener of deframing events. -
Constructor Summary
ConstructorsConstructorDescriptionMessageDeframer
(MessageDeframer.Listener listener, Decompressor decompressor, int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer) Create a deframer. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this deframer and frees any resources.void
Close when any messages currently queued have been requested and delivered.void
deframe
(ReadableBuffer data) Adds the given data to this deframer and attempts delivery to the listener.boolean
isClosed()
Indicates whether or not this deframer has been closed.void
request
(int numMessages) Requests up to the given number of messages from the call.void
setDecompressor
(Decompressor decompressor) Sets the decompressor available to use.void
setFullStreamDecompressor
(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor) Sets the decompressor used for full-stream decompression.void
setMaxInboundMessageSize
(int messageSize)
-
Constructor Details
-
MessageDeframer
public MessageDeframer(MessageDeframer.Listener listener, Decompressor decompressor, int maxMessageSize, StatsTraceContext statsTraceCtx, TransportTracer transportTracer) Create a deframer.- Parameters:
listener
- listener for deframer events.decompressor
- the compression used if a compressed frame is encountered, withNONE
meaning unsupportedmaxMessageSize
- the maximum allowed size for received messages.
-
-
Method Details
-
setMaxInboundMessageSize
public void setMaxInboundMessageSize(int messageSize) - Specified by:
setMaxInboundMessageSize
in interfaceDeframer
-
setDecompressor
Description copied from interface:Deframer
Sets the decompressor available to use. The message encoding for the stream comes later in time, and thus will not be available at the time of construction. This should only be set once, since the compression codec cannot change after the headers have been sent.- Specified by:
setDecompressor
in interfaceDeframer
- Parameters:
decompressor
- the decompressing wrapper.
-
setFullStreamDecompressor
public void setFullStreamDecompressor(io.grpc.internal.GzipInflatingBuffer fullStreamDecompressor) Description copied from interface:Deframer
Sets the decompressor used for full-stream decompression. Full-stream decompression disables any per-message decompressor set byDeframer.setDecompressor(io.grpc.Decompressor)
.- Specified by:
setFullStreamDecompressor
in interfaceDeframer
- Parameters:
fullStreamDecompressor
- the decompressing wrapper
-
request
public void request(int numMessages) Description copied from interface:Deframer
Requests up to the given number of messages from the call. No additional messages will be delivered.If
Deframer.close()
has been called, this method will have no effect. -
deframe
Description copied from interface:Deframer
Adds the given data to this deframer and attempts delivery to the listener. -
closeWhenComplete
public void closeWhenComplete()Description copied from interface:Deframer
Close when any messages currently queued have been requested and delivered.- Specified by:
closeWhenComplete
in interfaceDeframer
-
close
public void close()Description copied from interface:Deframer
Closes this deframer and frees any resources. After this method is called, additional calls will have no effect. -
isClosed
public boolean isClosed()Indicates whether or not this deframer has been closed.
-