Class ArmeriaMessageFramer
java.lang.Object
com.linecorp.armeria.common.grpc.protocol.ArmeriaMessageFramer
- All Implemented Interfaces:
AutoCloseable
@UnstableApi public class ArmeriaMessageFramer extends Object implements AutoCloseable
A framer of messages for transport with the gRPC wire protocol. See
gRPC Wire Format
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 InputStream
s.
-
Field Summary
Fields Modifier and Type Field Description static int
NO_MAX_OUTBOUND_MESSAGE_SIZE
-
Constructor Summary
Constructors Constructor Description ArmeriaMessageFramer(ByteBufAllocator alloc, int maxOutboundMessageSize)
Constructs anArmeriaMessageFramer
to write messages to a gRPC request or response. -
Method Summary
Modifier and Type Method Description void
close()
boolean
isClosed()
Indicates whether or not this framer has been closed via a call to eitherclose()
.void
setCompressor(Compressor compressor)
Sets theCompressor
.void
setMessageCompression(boolean messageCompression)
Enables or disables message compression.ByteBufHttpData
writePayload(ByteBuf message)
Writes out a payload message.
-
Field Details
-
NO_MAX_OUTBOUND_MESSAGE_SIZE
public static final int NO_MAX_OUTBOUND_MESSAGE_SIZE- See Also:
- Constant Field Values
-
-
Constructor Details
-
ArmeriaMessageFramer
Constructs anArmeriaMessageFramer
to write messages to a gRPC request or response.
-
-
Method Details
-
writePayload
Writes out a payload message.- Parameters:
message
- the message to be written out. Ownership is taken byArmeriaMessageFramer
.- Returns:
- a
ByteBufHttpData
with the framed payload. Ownership is passed to caller.
-
setMessageCompression
public void setMessageCompression(boolean messageCompression)Enables or disables message compression.- Parameters:
messageCompression
- whether to enable message compression.
-
setCompressor
Sets theCompressor
. -
isClosed
public boolean isClosed()Indicates whether or not this framer has been closed via a call to eitherclose()
. -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-