- java.lang.Object
-
- io.netty5.channel.ChannelHandlerAdapter
-
- io.netty5.handler.codec.MessageToByteEncoder<DnsQuery>
-
- io.netty5.handler.codec.dns.TcpDnsQueryEncoder
-
- All Implemented Interfaces:
ChannelHandler
@UnstableApi public final class TcpDnsQueryEncoder extends MessageToByteEncoder<DnsQuery>
-
-
Constructor Summary
Constructors Constructor Description TcpDnsQueryEncoder()
Creates a new encoder with the default record encoder.TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specifiedrecordEncoder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Buffer
allocateBuffer(ChannelHandlerContext ctx, DnsQuery msg)
Allocate aBuffer
which will be used as argument of#encode(ChannelHandlerContext, I, Buffer)
.protected void
encode(ChannelHandlerContext ctx, DnsQuery msg, Buffer out)
Encode a message into aBuffer
.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.MessageToByteEncoder
acceptOutboundMessage, write
-
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, channelRead, channelReadComplete, channelRegistered, channelShutdown, channelUnregistered, channelWritabilityChanged, close, connect, deregister, disconnect, flush, handlerAdded, handlerRemoved, pendingOutboundBytes, read, register, sendOutboundEvent, shutdown
-
-
-
-
Constructor Detail
-
TcpDnsQueryEncoder
public TcpDnsQueryEncoder()
Creates a new encoder with the default record encoder.
-
TcpDnsQueryEncoder
public TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specifiedrecordEncoder
.
-
-
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.
-
encode
protected void encode(ChannelHandlerContext ctx, DnsQuery msg, Buffer out) throws Exception
Description copied from class:MessageToByteEncoder
Encode a message into aBuffer
. This method will be called for each written message that can be handled by this encoder.- Specified by:
encode
in classMessageToByteEncoder<DnsQuery>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToByteEncoder
belongs tomsg
- the message to encodeout
- theBuffer
into which the encoded message will be written- Throws:
Exception
- is thrown if an error occurs
-
allocateBuffer
protected Buffer allocateBuffer(ChannelHandlerContext ctx, DnsQuery msg)
Description copied from class:MessageToByteEncoder
Allocate aBuffer
which will be used as argument of#encode(ChannelHandlerContext, I, Buffer)
.- Specified by:
allocateBuffer
in classMessageToByteEncoder<DnsQuery>
- Parameters:
ctx
- theChannelHandlerContext
which thisMessageToByteEncoder
belongs tomsg
- the message to be encoded
-
-