Class DnsCodecUtil


  • final class DnsCodecUtil
    extends java.lang.Object
    • Constructor Detail

      • DnsCodecUtil

        private DnsCodecUtil()
    • Method Detail

      • encodeDomainName

        static void encodeDomainName​(java.lang.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.
      • decodeDomainName

        static java.lang.String decodeDomainName​(ByteBuf in)
      • decompressDomainName

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