Class ArmeriaMessageFramer
- java.lang.Object
-
- com.linecorp.armeria.common.grpc.protocol.ArmeriaMessageFramer
-
- All Implemented Interfaces:
AutoCloseable
public class ArmeriaMessageFramer extends Object implements AutoCloseable
A framer of messages for transport with the gRPC wire protocol. See gRPC Wire Protocol 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 usingByteBufdirectly. The code has been vastly simplified due to the lack of support for arbitraryInputStreams.
-
-
Field Summary
Fields Modifier and Type Field Description static intNO_MAX_OUTBOUND_MESSAGE_SIZE
-
Constructor Summary
Constructors Constructor Description ArmeriaMessageFramer(ByteBufAllocator alloc, int maxOutboundMessageSize)Constructs anArmeriaMessageFramerto write messages to a gRPC request or response.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanisClosed()Indicates whether or not this framer has been closed via a call to eitherclose().voidsetCompressor(Compressor compressor)voidsetMessageCompression(boolean messageCompression)com.linecorp.armeria.unsafe.ByteBufHttpDatawritePayload(ByteBuf message)Writes out a payload message.
-
-
-
Field Detail
-
NO_MAX_OUTBOUND_MESSAGE_SIZE
public static final int NO_MAX_OUTBOUND_MESSAGE_SIZE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ArmeriaMessageFramer
public ArmeriaMessageFramer(ByteBufAllocator alloc, int maxOutboundMessageSize)
Constructs anArmeriaMessageFramerto write messages to a gRPC request or response.
-
-
Method Detail
-
writePayload
public com.linecorp.armeria.unsafe.ByteBufHttpData writePayload(ByteBuf message)
Writes out a payload message.- Parameters:
message- the message to be written out. Ownership is taken byArmeriaMessageFramer.- Returns:
- a
ByteBufHttpDatawith the framed payload. Ownership is passed to caller.
-
setMessageCompression
public void setMessageCompression(boolean messageCompression)
-
setCompressor
public void setCompressor(@Nullable Compressor compressor)
-
isClosed
public boolean isClosed()
Indicates whether or not this framer has been closed via a call to eitherclose().
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable
-
-