public class DatagramPacketDecoder extends MessageToMessageDecoder<DatagramPacket>
DatagramPacket using
the specified ByteBuf decoder. E.g.,
ChannelPipeline pipeline = ...;
pipeline.addLast("udpDecoder", new DatagramPacketDecoder(new ProtobufDecoder(...));
ChannelHandler.Sharable| Constructor and Description |
|---|
DatagramPacketDecoder(MessageToMessageDecoder<ByteBuf> decoder)
Create a
DatagramPacket decoder using the specified ByteBuf decoder. |
channelReadensureNotSharablepublic DatagramPacketDecoder(MessageToMessageDecoder<ByteBuf> decoder)
DatagramPacket decoder using the specified ByteBuf decoder.decoder - the specified ByteBuf decoderpublic boolean acceptInboundMessage(Object msg) throws Exception
MessageToMessageDecodertrue if the given message should be handled. If false it will be passed to the next
ChannelInboundHandler in the ChannelPipeline.acceptInboundMessage in class MessageToMessageDecoder<DatagramPacket>Exceptionprotected void decode(ChannelHandlerContext ctx, DatagramPacket msg, List<Object> out) throws Exception
MessageToMessageDecoderdecode in class MessageToMessageDecoder<DatagramPacket>ctx - the ChannelHandlerContext which this MessageToMessageDecoder belongs tomsg - the message to decode to an other oneout - the List to which decoded messages should be addedException - is thrown if an error occurspublic void channelRegistered(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelRegistered() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelRegistered in interface ChannelInboundHandlerchannelRegistered in class ChannelInboundHandlerAdapterExceptionpublic void channelUnregistered(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelUnregistered() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelUnregistered in interface ChannelInboundHandlerchannelUnregistered in class ChannelInboundHandlerAdapterExceptionpublic void channelActive(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelActive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelActive in interface ChannelInboundHandlerchannelActive in class ChannelInboundHandlerAdapterExceptionpublic void channelInactive(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelInactive() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelInactive in interface ChannelInboundHandlerchannelInactive in class ChannelInboundHandlerAdapterExceptionpublic void channelReadComplete(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelReadComplete() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelReadComplete in interface ChannelInboundHandlerchannelReadComplete in class MessageToMessageDecoder<DatagramPacket>Exceptionpublic void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireUserEventTriggered(Object) to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.userEventTriggered in interface ChannelInboundHandleruserEventTriggered in class ChannelInboundHandlerAdapterExceptionpublic void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireChannelWritabilityChanged() to forward
to the next ChannelInboundHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.channelWritabilityChanged in interface ChannelInboundHandlerchannelWritabilityChanged in class ChannelInboundHandlerAdapterExceptionpublic void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
ChannelInboundHandlerAdapterChannelHandlerContext.fireExceptionCaught(Throwable) to forward
to the next ChannelHandler in the ChannelPipeline.
Sub-classes may override this method to change behavior.exceptionCaught in interface ChannelHandlerexceptionCaught in interface ChannelInboundHandlerexceptionCaught in class ChannelInboundHandlerAdapterExceptionpublic void handlerAdded(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerAdded in interface ChannelHandlerhandlerAdded in class ChannelHandlerAdapterExceptionpublic void handlerRemoved(ChannelHandlerContext ctx) throws Exception
ChannelHandlerAdapterhandlerRemoved in interface ChannelHandlerhandlerRemoved in class ChannelHandlerAdapterExceptionpublic boolean isSharable()
ChannelHandlerAdapterisSharable in class ChannelHandlerAdapterCopyright © 2008–2025 The Netty Project. All rights reserved.