Class ArmeriaMessageDeframer
java.lang.Object
com.linecorp.armeria.common.grpc.protocol.ArmeriaMessageDeframer
- All Implemented Interfaces:
HttpDecoder<DeframedMessage>
,StreamDecoder<HttpData,
DeframedMessage>
@UnstableApi
public class ArmeriaMessageDeframer
extends Object
implements HttpDecoder<DeframedMessage>
A deframer of messages transported in the gRPC wire format. See
gRPC Wire Format
for more detail on the protocol.
The logic has been mostly copied from io.grpc.internal.MessageDeframer
, while removing the buffer
abstraction in favor of using ByteBuf
directly, and allowing the delivery of uncompressed frames as
a ByteBuf
to optimize message parsing.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionArmeriaMessageDeframer
(int maxMessageLength) Construct anArmeriaMessageDeframer
for reading messages out of a gRPC request or response.ArmeriaMessageDeframer
(int maxMessageLength, ByteBufAllocator alloc, boolean grpcWebText) Construct anArmeriaMessageDeframer
for reading messages out of a gRPC request or response with the specified parameters. -
Method Summary
Modifier and TypeMethodDescriptiondecompressor
(@Nullable Decompressor decompressor) Sets theDecompressor
for this deframer.void
Decodes a stream of data to N objects.Converts the specifiedStreamDecoder
type object into aByteBuf
that is added toStreamDecoderInput
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.linecorp.armeria.common.stream.HttpDecoder
processHeaders, processInformationalHeaders, processTrailers
Methods inherited from interface com.linecorp.armeria.common.stream.StreamDecoder
processOnComplete, processOnError
-
Field Details
-
NO_MAX_INBOUND_MESSAGE_SIZE
public static final int NO_MAX_INBOUND_MESSAGE_SIZE- See Also:
-
-
Constructor Details
-
ArmeriaMessageDeframer
public ArmeriaMessageDeframer(int maxMessageLength) Construct anArmeriaMessageDeframer
for reading messages out of a gRPC request or response. -
ArmeriaMessageDeframer
Construct anArmeriaMessageDeframer
for reading messages out of a gRPC request or response with the specified parameters.
-
-
Method Details
-
toByteBuf
Description copied from interface:StreamDecoder
Converts the specifiedStreamDecoder
type object into aByteBuf
that is added toStreamDecoderInput
.- Specified by:
toByteBuf
in interfaceHttpDecoder<DeframedMessage>
- Specified by:
toByteBuf
in interfaceStreamDecoder<HttpData,
DeframedMessage>
-
process
public void process(StreamDecoderInput in, StreamDecoderOutput<DeframedMessage> out) throws Exception Description copied from interface:StreamDecoder
Decodes a stream of data to N objects. This method will be called whenever an object is signaled fromPublisher
.- Specified by:
process
in interfaceStreamDecoder<HttpData,
DeframedMessage> - Throws:
Exception
-
decompressor
Sets theDecompressor
for this deframer.
-