public class DatagramPacketDecoder extends MessageToMessageDecoder<io.netty.channel.socket.DatagramPacket>
DatagramPacket
using
the specified ByteBuf
decoder. E.g.,
ChannelPipeline
pipeline = ...;
pipeline.addLast("udpDecoder", new DatagramPacketDecoder
(new ProtobufDecoder
(...));
Constructor and Description |
---|
DatagramPacketDecoder(MessageToMessageDecoder<io.netty.buffer.ByteBuf> decoder)
Create a
DatagramPacket decoder using the specified ByteBuf decoder. |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptInboundMessage(Object msg)
Returns
true if the given message should be handled. |
void |
channelActive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelInactive(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelRegistered(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) |
void |
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) |
protected void |
decode(io.netty.channel.ChannelHandlerContext ctx,
io.netty.channel.socket.DatagramPacket msg,
List<Object> out)
Decode from one message to an other.
|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
void |
handlerAdded(io.netty.channel.ChannelHandlerContext ctx) |
void |
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) |
boolean |
isSharable() |
void |
userEventTriggered(io.netty.channel.ChannelHandlerContext ctx,
Object evt) |
channelRead
public DatagramPacketDecoder(MessageToMessageDecoder<io.netty.buffer.ByteBuf> decoder)
DatagramPacket
decoder using the specified ByteBuf
decoder.decoder
- the specified ByteBuf
decoderpublic boolean acceptInboundMessage(Object msg) throws Exception
MessageToMessageDecoder
true
if the given message should be handled. If false
it will be passed to the next
ChannelInboundHandler
in the ChannelPipeline
.acceptInboundMessage
in class MessageToMessageDecoder<io.netty.channel.socket.DatagramPacket>
Exception
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.socket.DatagramPacket msg, List<Object> out) throws Exception
MessageToMessageDecoder
decode
in class MessageToMessageDecoder<io.netty.channel.socket.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(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelRegistered
in interface io.netty.channel.ChannelInboundHandler
channelRegistered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelUnregistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelUnregistered
in interface io.netty.channel.ChannelInboundHandler
channelUnregistered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelActive
in interface io.netty.channel.ChannelInboundHandler
channelActive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelInactive
in interface io.netty.channel.ChannelInboundHandler
channelInactive
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelReadComplete(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelReadComplete
in interface io.netty.channel.ChannelInboundHandler
channelReadComplete
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
userEventTriggered
in interface io.netty.channel.ChannelInboundHandler
userEventTriggered
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception
channelWritabilityChanged
in interface io.netty.channel.ChannelInboundHandler
channelWritabilityChanged
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
handlerAdded
in interface io.netty.channel.ChannelHandler
handlerAdded
in class io.netty.channel.ChannelHandlerAdapter
Exception
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) throws Exception
handlerRemoved
in interface io.netty.channel.ChannelHandler
handlerRemoved
in class io.netty.channel.ChannelHandlerAdapter
Exception
public boolean isSharable()
isSharable
in class io.netty.channel.ChannelHandlerAdapter
Copyright © 2008–2019 The Netty Project. All rights reserved.