@ChannelHandler.Sharable @UnstableApi public final class TcpDnsQueryEncoder extends MessageToByteEncoder<DnsQuery>
ChannelHandler.Sharable
构造器和说明 |
---|
TcpDnsQueryEncoder()
Creates a new encoder with the default record encoder.
|
TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specified
recordEncoder . |
限定符和类型 | 方法和说明 |
---|---|
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, write
bind, close, connect, deregister, disconnect, flush, read
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerAdded, handlerRemoved
public TcpDnsQueryEncoder()
public TcpDnsQueryEncoder(DnsRecordEncoder recordEncoder)
recordEncoder
.protected void encode(ChannelHandlerContext ctx, DnsQuery msg, ByteBuf out) throws java.lang.Exception
MessageToByteEncoder
ByteBuf
. This method will be called for each written message that can be handled
by this encoder.encode
在类中 MessageToByteEncoder<DnsQuery>
ctx
- the ChannelHandlerContext
which this MessageToByteEncoder
belongs tomsg
- the message to encodeout
- the ByteBuf
into which the encoded message will be writtenjava.lang.Exception
- is thrown if an error occursprotected ByteBuf allocateBuffer(ChannelHandlerContext ctx, DnsQuery msg, boolean preferDirect)
MessageToByteEncoder
ByteBuf
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
在类中 MessageToByteEncoder<DnsQuery>