Class TcpDnsQueryEncoder
java.lang.Object
- All Implemented Interfaces:
ChannelHandler, ChannelOutboundHandler
-
Nested Class Summary
Nested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new encoder with the default record encoder.TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder) Creates a new encoder with the specifiedrecordEncoder. -
Method Summary
Modifier and TypeMethodDescriptionprotected ByteBufallocateBuffer(ChannelHandlerContext ctx, DnsQuery msg, boolean preferDirect) Allocate aByteBufwhich will be used as argument ofMessageToByteEncoder.encode(ChannelHandlerContext, I, ByteBuf).protected voidencode(ChannelHandlerContext ctx, DnsQuery msg, ByteBuf out) Encode a message into aByteBuf.Methods inherited from class MessageToByteEncoder
acceptOutboundMessage, isPreferDirect, writeMethods inherited from class ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, readMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ChannelHandler
exceptionCaught, handlerAdded, handlerRemoved
-
Constructor Details
-
TcpDnsQueryEncoder
public TcpDnsQueryEncoder()Creates a new encoder with the default record encoder. -
TcpDnsQueryEncoder
Creates a new encoder with the specifiedrecordEncoder.
-
-
Method Details
-
encode
Description copied from class:MessageToByteEncoderEncode a message into aByteBuf. 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- theByteBufinto which the encoded message will be written- Throws:
Exception- is thrown if an error occurs
-
allocateBuffer
Description copied from class:MessageToByteEncoderAllocate aByteBufwhich will be used as argument ofMessageToByteEncoder.encode(ChannelHandlerContext, I, ByteBuf). Sub-classes may override this method to returnByteBufwith a perfect matchinginitialCapacity.- Overrides:
allocateBufferin classMessageToByteEncoder<DnsQuery>
-