- 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 BufferallocateBuffer(ChannelHandlerContext ctx, DnsQuery msg)Allocate aBufferwhich will be used as argument of#encode(ChannelHandlerContext, I, Buffer).protected voidencode(ChannelHandlerContext ctx, DnsQuery msg, Buffer out)Encode a message into aBuffer.booleanisSharable()Returnstrueif 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:ChannelHandlerReturnstrueif 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:MessageToByteEncoderEncode a message into aBuffer. This method will be called for each written message that can be handled by this encoder.- Specified by:
encodein classMessageToByteEncoder<DnsQuery>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToByteEncoderbelongs tomsg- the message to encodeout- theBufferinto 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:MessageToByteEncoderAllocate aBufferwhich will be used as argument of#encode(ChannelHandlerContext, I, Buffer).- Specified by:
allocateBufferin classMessageToByteEncoder<DnsQuery>- Parameters:
ctx- theChannelHandlerContextwhich thisMessageToByteEncoderbelongs tomsg- the message to be encoded
-
-