- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToMessageDecoder<DatagramPacket>
-
- io.netty5.handler.codec.dns.DatagramDnsResponseDecoder
-
- All Implemented Interfaces:
ChannelHandler
@UnstableApi public class DatagramDnsResponseDecoder extends MessageToMessageDecoder<DatagramPacket>
Decodes aDatagramPacket
into aDatagramDnsResponse
.
-
-
Constructor Summary
Constructors Constructor Description DatagramDnsResponseDecoder()
Creates a new decoder with the default record decoder.DatagramDnsResponseDecoder(DnsRecordDecoder recordDecoder)
Creates a new decoder with the specifiedrecordDecoder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
decode(ChannelHandlerContext ctx, DatagramPacket packet)
Decode from one message to another.protected DnsResponse
decodeResponse(ChannelHandlerContext ctx, DatagramPacket packet)
boolean
isSharable()
Returnstrue
if this handler is sharable and thus can be added to more than oneChannelPipeline
.-
Methods inherited from class io.netty5.handler.codec.MessageToMessageDecoder
acceptInboundMessage, channelRead, decodeAndClose
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty5.channel.ChannelHandler
bind, channelActive, channelExceptionCaught, channelInactive, channelInboundEvent, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown, write
-
-
-
-
Constructor Detail
-
DatagramDnsResponseDecoder
public DatagramDnsResponseDecoder()
Creates a new decoder with the default record decoder.
-
DatagramDnsResponseDecoder
public DatagramDnsResponseDecoder(DnsRecordDecoder recordDecoder)
Creates a new decoder with the specifiedrecordDecoder
.
-
-
Method Detail
-
isSharable
public boolean isSharable()
Description copied from interface:ChannelHandler
Returnstrue
if this handler is sharable and thus can be added to more than oneChannelPipeline
. By default, this method returnsfalse
. If this method returnsfalse
, you have to create a new handler instance every time you add it to a pipeline because it has unshared state such as member variables.
-
decode
protected void decode(ChannelHandlerContext ctx, DatagramPacket packet) throws Exception
Description copied from class:MessageToMessageDecoder
Decode from one message to another. This method will be called for each written message that can be handled by this decoder.The message will be disposed of after this call.
Subclasses that wish to sometimes pass messages through, should instead override the
MessageToMessageDecoder.decodeAndClose(ChannelHandlerContext, Object)
method.- Overrides:
decode
in classMessageToMessageDecoder<DatagramPacket>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToMessageDecoder
belongs topacket
- the message to decode to another one- Throws:
Exception
- is thrown if an error occurs
-
decodeResponse
protected DnsResponse decodeResponse(ChannelHandlerContext ctx, DatagramPacket packet) throws Exception
- Throws:
Exception
-
-