Class DatagramDnsResponseEncoder

    • Constructor Detail

      • DatagramDnsResponseEncoder

        public DatagramDnsResponseEncoder​(DnsRecordEncoder recordEncoder)
        Creates a new encoder with the specified recordEncoder.
    • Method Detail

      • allocateBuffer

        protected ByteBuf allocateBuffer​(ChannelHandlerContext ctx,
                                         AddressedEnvelope<DnsResponse,​java.net.InetSocketAddress> msg)
                                  throws java.lang.Exception
        Allocate a 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.
        Throws:
        java.lang.Exception
      • encodeHeader

        private static void encodeHeader​(DnsResponse response,
                                         ByteBuf buf)
        Encodes the header that is always 12 bytes long.
        Parameters:
        response - the response header being encoded
        buf - the buffer the encoded data should be written to
      • encodeQuestions

        private void encodeQuestions​(DnsResponse response,
                                     ByteBuf buf)
                              throws java.lang.Exception
        Throws:
        java.lang.Exception
      • encodeRecords

        private void encodeRecords​(DnsResponse response,
                                   DnsSection section,
                                   ByteBuf buf)
                            throws java.lang.Exception
        Throws:
        java.lang.Exception