Class DefaultDnsRecordEncoder

java.lang.Object
io.netty.handler.codec.dns.DefaultDnsRecordEncoder
All Implemented Interfaces:
DnsRecordEncoder

public class DefaultDnsRecordEncoder extends java.lang.Object implements DnsRecordEncoder
The default DnsRecordEncoder implementation.
See Also:
  • Field Details

    • PREFIX_MASK

      private static final int PREFIX_MASK
      See Also:
    • SUPPORTED_MESSAGES

      private static final java.lang.Class<?>[] SUPPORTED_MESSAGES
  • Constructor Details

    • DefaultDnsRecordEncoder

      protected DefaultDnsRecordEncoder()
      Creates a new instance.
  • Method Details

    • encodeQuestion

      public final void encodeQuestion(DnsQuestion question, ByteBuf out) throws java.lang.Exception
      Description copied from interface: DnsRecordEncoder
      Encodes a DnsQuestion.
      Specified by:
      encodeQuestion in interface DnsRecordEncoder
      Parameters:
      out - the output buffer where the encoded question will be written to
      Throws:
      java.lang.Exception
    • encodeRecord

      public void encodeRecord(DnsRecord record, ByteBuf out) throws java.lang.Exception
      Description copied from interface: DnsRecordEncoder
      Encodes a DnsRecord.
      Specified by:
      encodeRecord in interface DnsRecordEncoder
      Parameters:
      out - the output buffer where the encoded record will be written to
      Throws:
      java.lang.Exception
    • encodeRecord0

      private void encodeRecord0(DnsRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodePtrRecord

      private void encodePtrRecord(DnsPtrRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodeOptPseudoRecord

      private void encodeOptPseudoRecord(DnsOptPseudoRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodeOptCookieRecord

      private void encodeOptCookieRecord(DnsOptCookieRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodeOptEcsRecord

      private void encodeOptEcsRecord(DnsOptEcsRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • calculateEcsAddressLength

      static int calculateEcsAddressLength(int sourcePrefixLength, int lowOrderBitsToPreserve)
    • encodeRawRecord

      private void encodeRawRecord(DnsRawRecord record, ByteBuf out) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • encodeName

      protected void encodeName(java.lang.String name, ByteBuf buf) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • padWithZeros

      private static byte padWithZeros(byte b, int lowOrderBitsToPreserve)