Package io.netty.handler.codec
Class DatagramPacketDecoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.MessageToMessageDecoder<DatagramPacket>
io.netty.handler.codec.DatagramPacketDecoder
- All Implemented Interfaces:
ChannelHandler
,ChannelInboundHandler
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
invalid reference
ProtobufDecoder
(...));
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if the given message should be handled.void
CallsChannelHandlerContext.fireChannelActive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
CallsChannelHandlerContext.fireChannelInactive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
CallsChannelHandlerContext.fireChannelReadComplete()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
CallsChannelHandlerContext.fireChannelRegistered()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
CallsChannelHandlerContext.fireChannelUnregistered()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.void
CallsChannelHandlerContext.fireChannelWritabilityChanged()
to forward to the nextChannelInboundHandler
in theChannelPipeline
.protected void
decode
(ChannelHandlerContext ctx, DatagramPacket msg, List<Object> out) Decode from one message to an other.void
exceptionCaught
(ChannelHandlerContext ctx, Throwable cause) CallsChannelHandlerContext.fireExceptionCaught(Throwable)
to forward to the nextChannelHandler
in theChannelPipeline
.void
Do nothing by default, sub-classes may override this method.void
Do nothing by default, sub-classes may override this method.boolean
Returntrue
if the implementation isChannelHandler.Sharable
and so can be added to differentChannelPipeline
s.void
userEventTriggered
(ChannelHandlerContext ctx, Object evt) CallsChannelHandlerContext.fireUserEventTriggered(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
.Methods inherited from class io.netty.handler.codec.MessageToMessageDecoder
channelRead
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable
-
Field Details
-
decoder
-
-
Constructor Details
-
DatagramPacketDecoder
Create aDatagramPacket
decoder using the specifiedByteBuf
decoder.- Parameters:
decoder
- the specifiedByteBuf
decoder
-
-
Method Details
-
acceptInboundMessage
Description copied from class:MessageToMessageDecoder
Returnstrue
if the given message should be handled. Iffalse
it will be passed to the nextChannelInboundHandler
in theChannelPipeline
.- Overrides:
acceptInboundMessage
in classMessageToMessageDecoder<DatagramPacket>
- Throws:
Exception
-
decode
protected void decode(ChannelHandlerContext ctx, DatagramPacket msg, List<Object> out) throws Exception Description copied from class:MessageToMessageDecoder
Decode from one message to an other. This method will be called for each written message that can be handled by this decoder.- Specified by:
decode
in classMessageToMessageDecoder<DatagramPacket>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToMessageDecoder
belongs tomsg
- the message to decode to an other oneout
- theList
to which decoded messages should be added- Throws:
Exception
- is thrown if an error occurs
-
channelRegistered
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelRegistered()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelRegistered
in interfaceChannelInboundHandler
- Overrides:
channelRegistered
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelUnregistered
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelUnregistered()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelUnregistered
in interfaceChannelInboundHandler
- Overrides:
channelUnregistered
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelActive
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelActive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelActive
in interfaceChannelInboundHandler
- Overrides:
channelActive
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelInactive
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelInactive()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelInactive
in interfaceChannelInboundHandler
- Overrides:
channelInactive
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelReadComplete
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelReadComplete()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelReadComplete
in interfaceChannelInboundHandler
- Overrides:
channelReadComplete
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
userEventTriggered
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireUserEventTriggered(Object)
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
userEventTriggered
in interfaceChannelInboundHandler
- Overrides:
userEventTriggered
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
channelWritabilityChanged
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireChannelWritabilityChanged()
to forward to the nextChannelInboundHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
channelWritabilityChanged
in interfaceChannelInboundHandler
- Overrides:
channelWritabilityChanged
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
exceptionCaught
Description copied from class:ChannelInboundHandlerAdapter
CallsChannelHandlerContext.fireExceptionCaught(Throwable)
to forward to the nextChannelHandler
in theChannelPipeline
. Sub-classes may override this method to change behavior.- Specified by:
exceptionCaught
in interfaceChannelHandler
- Specified by:
exceptionCaught
in interfaceChannelInboundHandler
- Overrides:
exceptionCaught
in classChannelInboundHandlerAdapter
- Throws:
Exception
-
handlerAdded
Description copied from class:ChannelHandlerAdapter
Do nothing by default, sub-classes may override this method.- Specified by:
handlerAdded
in interfaceChannelHandler
- Overrides:
handlerAdded
in classChannelHandlerAdapter
- Throws:
Exception
-
handlerRemoved
Description copied from class:ChannelHandlerAdapter
Do nothing by default, sub-classes may override this method.- Specified by:
handlerRemoved
in interfaceChannelHandler
- Overrides:
handlerRemoved
in classChannelHandlerAdapter
- Throws:
Exception
-
isSharable
public boolean isSharable()Description copied from class:ChannelHandlerAdapter
Returntrue
if the implementation isChannelHandler.Sharable
and so can be added to differentChannelPipeline
s.- Overrides:
isSharable
in classChannelHandlerAdapter
-