Class DnsCodecUtil

java.lang.Object
io.netty.handler.codec.dns.DnsCodecUtil

final class DnsCodecUtil extends Object
  • Field Details

  • Constructor Details

    • DnsCodecUtil

      private DnsCodecUtil()
  • Method Details

    • encodeDomainName

      static void encodeDomainName(String name, ByteBuf buf)
    • calculateMaxNameLength

      static int calculateMaxNameLength(int readable)
      Returns the initial capacity to use for the StringBuilder that accumulates a decoded domain name. A decoded name can never exceed MAX_DOMAIN_NAME_LENGTH characters (see the check in decodeDomainName(ByteBuf)), so the capacity must not scale with readable, the number of bytes left in the whole message: doing so would let a message with a huge amount of trailing data (e.g. many more records after this name) force an oversized allocation for every single name decoded from it.
    • checkRecordCount

      static int checkRecordCount(DnsSection section, int count)
      Ensures the record count of a section, as announced in the header of a DNS message, does not exceed MAX_RECORDS_PER_SECTION.
      Throws:
      TooLongFrameException - if the count is too large.
    • decodeDomainName

      static String decodeDomainName(ByteBuf in)
    • decompressDomainName

      static ByteBuf decompressDomainName(ByteBuf compression)
      Decompress pointer data.
      Parameters:
      compression - compressed data
      Returns:
      decompressed data