Top Description Fields Constructors Methods
io.netty.handler.codec

public Class DatagramPacketDecoder

extends MessageToMessageDecoder<DatagramPacket>
Class Inheritance
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, .ChannelPipeline, io.netty.channel.socket.DatagramPacket, io.netty.handler.codec.protobuf.ProtobufDecoder, java.util.List

A decoder that decodes the content of the received DatagramPacket using the specified ByteBuf decoder. E.g.,

ChannelPipeline pipeline = ...;
pipeline.addLast("udpDecoder", new DatagramPacketDecoder(new ProtobufDecoder(...));

Field Summary

Modifier and TypeField and Description
private final MessageToMessageDecoder<ByteBuf>

Constructor Summary

AccessConstructor and Description
public
DatagramPacketDecoder(MessageToMessageDecoder<ByteBuf>
the specified ByteBuf decoder
decoder
)

Create a DatagramPacket decoder using the specified ByteBuf decoder.

Method Summary

Modifier and TypeMethod and Description
public boolean
acceptInboundMessage(Object msg)

Overrides io.netty.handler.codec.MessageToMessageDecoder.acceptInboundMessage.

Returns true if the given message should be handled.
public void
public void
public void
public void
public void
public void
protected void
decode(ChannelHandlerContext ctx, DatagramPacket
the message to decode to an other one
msg
,
List<Object>
the List to which decoded messages should be added
out
)

Implements abstract io.netty.handler.codec.MessageToMessageDecoder.decode.

Decode from one message to an other.
public void
public void
handlerAdded(ChannelHandlerContext ctx)

Overrides io.netty.channel.ChannelHandlerAdapter.handlerAdded.

Implements io.netty.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.
public void
handlerRemoved(ChannelHandlerContext ctx)

Overrides io.netty.channel.ChannelHandlerAdapter.handlerRemoved.

Implements io.netty.channel.ChannelHandler.handlerRemoved.

Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.
public boolean
isSharable()

Overrides io.netty.channel.ChannelHandlerAdapter.isSharable.

Return true if the implementation is Sharable and so can be added to different ChannelPipelines.
public void
Inherited from io.netty.handler.codec.MessageToMessageDecoder:
channelRead

Field Detail

decoderback to summary
private final MessageToMessageDecoder<ByteBuf> decoder

Constructor Detail

DatagramPacketDecoderback to summary
public DatagramPacketDecoder(MessageToMessageDecoder<ByteBuf> decoder)

Create a DatagramPacket decoder using the specified ByteBuf decoder.

Parameters
decoder:MessageToMessageDecoder<ByteBuf>

the specified ByteBuf decoder

Method Detail

acceptInboundMessageback to summary
public boolean acceptInboundMessage(Object msg) throws Exception

Overrides io.netty.handler.codec.MessageToMessageDecoder.acceptInboundMessage.

Doc from io.netty.handler.codec.MessageToMessageDecoder.acceptInboundMessage.

Returns true if the given message should be handled. If false it will be passed to the next ChannelInboundHandler in the ChannelPipeline.

Annotations
@Override
channelActiveback to summary
public void channelActive(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelActive.

Implements io.netty.channel.ChannelInboundHandler.channelActive.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelActive.

Calls ChannelHandlerContext#fireChannelActive() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
channelInactiveback to summary
public void channelInactive(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelInactive.

Implements io.netty.channel.ChannelInboundHandler.channelInactive.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelInactive.

Calls ChannelHandlerContext#fireChannelInactive() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
channelReadCompleteback to summary
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelReadComplete.

Implements io.netty.channel.ChannelInboundHandler.channelReadComplete.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelReadComplete.

Calls ChannelHandlerContext#fireChannelReadComplete() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
channelRegisteredback to summary
public void channelRegistered(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelRegistered.

Implements io.netty.channel.ChannelInboundHandler.channelRegistered.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelRegistered.

Calls ChannelHandlerContext#fireChannelRegistered() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
channelUnregisteredback to summary
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelUnregistered.

Implements io.netty.channel.ChannelInboundHandler.channelUnregistered.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelUnregistered.

Calls ChannelHandlerContext#fireChannelUnregistered() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
channelWritabilityChangedback to summary
public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.channelWritabilityChanged.

Implements io.netty.channel.ChannelInboundHandler.channelWritabilityChanged.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.channelWritabilityChanged.

Calls ChannelHandlerContext#fireChannelWritabilityChanged() to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
decodeback to summary
protected void decode(ChannelHandlerContext ctx, DatagramPacket msg, List<Object> out) throws Exception

Implements abstract io.netty.handler.codec.MessageToMessageDecoder.decode.

Doc from io.netty.handler.codec.MessageToMessageDecoder.decode.

Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.

Parameters
ctx:ChannelHandlerContext

the ChannelHandlerContext which this MessageToMessageDecoder belongs to

msg:DatagramPacket

the message to decode to an other one

out:List<Object>

the List to which decoded messages should be added

Annotations
@Override
Exceptions
Exception:
is thrown if an error occurs
exceptionCaughtback to summary
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Implements io.netty.channel.ChannelInboundHandler.exceptionCaught, io.netty.channel.ChannelHandler.exceptionCaught.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught.

Calls ChannelHandlerContext#fireExceptionCaught(Throwable) to forward to the next ChannelHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override
handlerAddedback to summary
public void handlerAdded(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelHandlerAdapter.handlerAdded.

Implements io.netty.channel.ChannelHandler.handlerAdded.

Doc from io.netty.channel.ChannelHandler.handlerAdded.

Gets called after the ChannelHandler was added to the actual context and it's ready to handle events.

Annotations
@Override
handlerRemovedback to summary
public void handlerRemoved(ChannelHandlerContext ctx) throws Exception

Overrides io.netty.channel.ChannelHandlerAdapter.handlerRemoved.

Implements io.netty.channel.ChannelHandler.handlerRemoved.

Doc from io.netty.channel.ChannelHandler.handlerRemoved.

Gets called after the ChannelHandler was removed from the actual context and it doesn't handle events anymore.

Annotations
@Override
isSharableback to summary
public boolean isSharable()

Overrides io.netty.channel.ChannelHandlerAdapter.isSharable.

Doc from io.netty.channel.ChannelHandlerAdapter.isSharable.

Return true if the implementation is Sharable and so can be added to different ChannelPipelines.

Annotations
@Override
userEventTriggeredback to summary
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception

Overrides io.netty.channel.ChannelInboundHandlerAdapter.userEventTriggered.

Implements io.netty.channel.ChannelInboundHandler.userEventTriggered.

Doc from io.netty.channel.ChannelInboundHandlerAdapter.userEventTriggered.

Calls ChannelHandlerContext#fireUserEventTriggered(Object) to forward to the next ChannelInboundHandler in the ChannelPipeline. Sub-classes may override this method to change behavior.

Annotations
@Override