AddressedEnvelope to DatagramPacket using
the specified message encoder. E.g.,
ChannelPipeline pipeline = ...;
pipeline.addLast("udpEncoder", new DatagramPacketEncoder(new ProtobufEncoder(...));
Note: As UDP packets are out-of-order, you should make sure the encoded message size are not greater than
the max safe packet size in your particular network path which guarantees no packet fragmentation.
| Modifier and Type | Field and Description |
|---|---|
| private final MessageToMessageEncoder |
| Access | Constructor and Description |
|---|---|
| public | DatagramPacketEncoder(MessageToMessageEncoder<? super M>
the specified message encoder encoder)Create an encoder that encodes the content in |
| encoder | back to summary |
|---|---|
| private final MessageToMessageEncoder<? super M> encoder | |
| DatagramPacketEncoder | back to summary |
|---|---|
| public DatagramPacketEncoder(MessageToMessageEncoder<? super M> encoder) Create an encoder that encodes the content in
| |
| acceptOutboundMessage | back to summary |
|---|---|
| public boolean acceptOutboundMessage(Object msg) throws Exception Overrides io. Doc from io. Returns
| |
| close | back to summary |
|---|---|
| public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| deregister | back to summary |
|---|---|
| public void deregister(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| disconnect | back to summary |
|---|---|
| public void disconnect(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| encode | back to summary |
|---|---|
| protected void encode(ChannelHandlerContext ctx, AddressedEnvelope<M, InetSocketAddress> msg, List<Object> out) throws Exception Implements abstract io. Doc from io. Encode from one message to an other. This method will be called for each written message that can be handled by this encoder.
| |
| exceptionCaught | back to summary |
|---|---|
| public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception Overrides io. Implements io. Doc from io. Gets called if a
| |
| flush | back to summary |
|---|---|
| public void flush(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |
| handlerAdded | back to summary |
|---|---|
| public void handlerAdded(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| handlerRemoved | back to summary |
|---|---|
| public void handlerRemoved(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Gets called after the
| |
| isSharable | back to summary |
|---|---|
| public boolean isSharable() Overrides io. Doc from io. Return
| |
| read | back to summary |
|---|---|
| public void read(ChannelHandlerContext ctx) throws Exception Overrides io. Implements io. Doc from io. Calls
| |