@UnstableApi @ChannelHandler.Sharable public class DatagramDnsResponseEncoder extends MessageToMessageEncoder<AddressedEnvelope<DnsResponse,java.net.InetSocketAddress>>
ChannelHandler.Sharable| Modifier and Type | Field and Description |
|---|---|
private DnsRecordEncoder |
recordEncoder |
| Constructor and Description |
|---|
DatagramDnsResponseEncoder()
Creates a new encoder with the default record encoder.
|
DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)
Creates a new encoder with the specified
recordEncoder. |
| Modifier and Type | Method and Description |
|---|---|
protected ByteBuf |
allocateBuffer(ChannelHandlerContext ctx,
AddressedEnvelope<DnsResponse,java.net.InetSocketAddress> msg)
Allocate a
ByteBuf which will be used for constructing a datagram packet. |
protected void |
encode(ChannelHandlerContext ctx,
AddressedEnvelope<DnsResponse,java.net.InetSocketAddress> in,
java.util.List<java.lang.Object> out)
Encode from one message to an other.
|
private static void |
encodeHeader(DnsResponse response,
ByteBuf buf)
Encodes the header that is always 12 bytes long.
|
private void |
encodeQuestions(DnsResponse response,
ByteBuf buf) |
private void |
encodeRecords(DnsResponse response,
DnsSection section,
ByteBuf buf) |
acceptOutboundMessage, writebind, close, connect, deregister, disconnect, flush, readensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexceptionCaught, handlerAdded, handlerRemovedprivate final DnsRecordEncoder recordEncoder
public DatagramDnsResponseEncoder()
public DatagramDnsResponseEncoder(DnsRecordEncoder recordEncoder)
recordEncoder.protected void encode(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse,java.net.InetSocketAddress> in, java.util.List<java.lang.Object> out) throws java.lang.Exception
MessageToMessageEncoderencode in class MessageToMessageEncoder<AddressedEnvelope<DnsResponse,java.net.InetSocketAddress>>ctx - the ChannelHandlerContext which this MessageToMessageEncoder belongs toin - the message to encode to an other oneout - the List into which the encoded msg should be added
needs to do some kind of aggregationjava.lang.Exception - is thrown if an error occursprotected ByteBuf allocateBuffer(ChannelHandlerContext ctx, AddressedEnvelope<DnsResponse,java.net.InetSocketAddress> msg) throws java.lang.Exception
ByteBuf which will be used for constructing a datagram packet.
Sub-classes may override this method to return a ByteBuf with a perfect matching initial capacity.java.lang.Exceptionprivate static void encodeHeader(DnsResponse response, ByteBuf buf)
response - the response header being encodedbuf - the buffer the encoded data should be written toprivate void encodeQuestions(DnsResponse response, ByteBuf buf) throws java.lang.Exception
java.lang.Exceptionprivate void encodeRecords(DnsResponse response, DnsSection section, ByteBuf buf) throws java.lang.Exception
java.lang.Exception