@ChannelHandler.Sharable public final class TcpDnsQueryEncoder extends MessageToByteEncoder<DnsQuery>
ChannelHandler.Sharable| Constructor and Description |
|---|
TcpDnsQueryEncoder()
Creates a new encoder with the default record encoder.
|
TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specified
recordEncoder. |
| Modifier and Type | Method and Description |
|---|---|
protected ByteBuf |
allocateBuffer(ChannelHandlerContext ctx,
DnsQuery msg,
boolean preferDirect)
Allocate a
ByteBuf which will be used as argument of #encode(ChannelHandlerContext, I, ByteBuf). |
protected void |
encode(ChannelHandlerContext ctx,
DnsQuery msg,
ByteBuf out)
Encode a message into a
ByteBuf. |
acceptOutboundMessage, isPreferDirect, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedpublic TcpDnsQueryEncoder()
public TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
recordEncoder.protected void encode(ChannelHandlerContext ctx, DnsQuery msg, ByteBuf out) throws Exception
MessageToByteEncoderByteBuf. This method will be called for each written message that can be handled
by this encoder.encode in class MessageToByteEncoder<DnsQuery>ctx - the ChannelHandlerContext which this MessageToByteEncoder belongs tomsg - the message to encodeout - the ByteBuf into which the encoded message will be writtenException - is thrown if an error occursprotected ByteBuf allocateBuffer(ChannelHandlerContext ctx, DnsQuery msg, boolean preferDirect)
MessageToByteEncoderByteBuf which will be used as argument of #encode(ChannelHandlerContext, I, ByteBuf).
Sub-classes may override this method to return ByteBuf with a perfect matching initialCapacity.allocateBuffer in class MessageToByteEncoder<DnsQuery>Copyright © 2008–2025 The Netty Project. All rights reserved.