Package org.drasyl.remote.handler
Class RemoteEnvelopeToByteBufCodec
- java.lang.Object
-
- org.drasyl.pipeline.skeleton.HandlerAdapter
-
- org.drasyl.pipeline.skeleton.AddressHandlerAdapter<A>
-
- org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler<I,E,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler<I,Event,O,A>
-
- org.drasyl.pipeline.skeleton.SimpleDuplexHandler<I,O,A>
-
- org.drasyl.pipeline.handler.codec.MessageToMessageCodec<io.netty.buffer.ByteBuf,RemoteEnvelope<? extends com.google.protobuf.MessageLite>,InetSocketAddressWrapper>
-
- org.drasyl.remote.handler.RemoteEnvelopeToByteBufCodec
-
- All Implemented Interfaces:
Handler
public final class RemoteEnvelopeToByteBufCodec extends MessageToMessageCodec<io.netty.buffer.ByteBuf,RemoteEnvelope<? extends com.google.protobuf.MessageLite>,InetSocketAddressWrapper>
This codec convertsRemoteEnvelope
toByteBuf
an vice vera.
-
-
Field Summary
Fields Modifier and Type Field Description static RemoteEnvelopeToByteBufCodec
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
decode(HandlerContext ctx, InetSocketAddressWrapper sender, io.netty.buffer.ByteBuf msg, List<Object> out)
Decode from one message to one or more other.protected void
encode(HandlerContext ctx, InetSocketAddressWrapper recipient, RemoteEnvelope<? extends com.google.protobuf.MessageLite> msg, List<Object> out)
Encode from one message to one or more other.-
Methods inherited from class org.drasyl.pipeline.handler.codec.MessageToMessageCodec
matchedInbound, matchedOutbound
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexHandler
matchedEvent, onEvent
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleDuplexEventAwareHandler
acceptOutbound, onOutbound
-
Methods inherited from class org.drasyl.pipeline.skeleton.SimpleInboundEventAwareHandler
acceptEvent, acceptInbound, onInbound
-
Methods inherited from class org.drasyl.pipeline.skeleton.AddressHandlerAdapter
acceptAddress
-
Methods inherited from class org.drasyl.pipeline.skeleton.HandlerAdapter
onAdded, onException, onRemoved
-
-
-
-
Field Detail
-
INSTANCE
public static final RemoteEnvelopeToByteBufCodec INSTANCE
-
-
Method Detail
-
decode
protected void decode(HandlerContext ctx, InetSocketAddressWrapper sender, io.netty.buffer.ByteBuf msg, List<Object> out) throws Exception
Description copied from class:MessageToMessageCodec
Decode from one message to one or more other. This method will be called for each inbound message that can be handled by this decoder.- Specified by:
decode
in classMessageToMessageCodec<io.netty.buffer.ByteBuf,RemoteEnvelope<? extends com.google.protobuf.MessageLite>,InetSocketAddressWrapper>
- Parameters:
ctx
- theHandlerContext
which thisMessageToMessageDecoder
belongs tosender
- the sender of the messagemsg
- the message to decodeout
- theList
to which decoded messages should be added- Throws:
Exception
- is thrown if an error occurs
-
encode
protected void encode(HandlerContext ctx, InetSocketAddressWrapper recipient, RemoteEnvelope<? extends com.google.protobuf.MessageLite> msg, List<Object> out) throws Exception
Description copied from class:MessageToMessageCodec
Encode from one message to one or more other. This method will be called for each outbound message that can be handled by this decoder.- Specified by:
encode
in classMessageToMessageCodec<io.netty.buffer.ByteBuf,RemoteEnvelope<? extends com.google.protobuf.MessageLite>,InetSocketAddressWrapper>
- Parameters:
ctx
- theHandlerContext
which thisMessageToMessageDecoder
belongs torecipient
- the recipient of the messagemsg
- the message to encodeout
- theList
to which encoded messages should be added- Throws:
Exception
- is thrown if an error occurs
-
-