Class DNSStringUtil


  • public class DNSStringUtil
    extends Object
    DNS Label Types Registration Procedures IESG Approval Reference [RFC-ietf-dnsext-rfc2671bis-edns0-10] Note IETF standards action required to allocate new types The top 2 bits of the first byte of an DNS label indicates the type of label. Registration of further Extended Label Types is closed per [RFC-ietf-dnsext-rfc2671bis-edns0-10]. Value Type Status Reference 0 0 Normal label lower 6 bits is the length of the label Standard [RFC1035] 1 1 Compressed label the lower 6 bits and the 8 bits from next octet form a pointer to the compression target. Standard [RFC1035] 0 1 Extended label type the lower 6 bits of this type (section 3) indicate the type of label in use Proposed [RFC-ietf-dnsext-rfc2671bis-edns0-10] 0 1 0 0 0 0 0 1 Binary Label Experimental not recommended [RFC3364][RFC3363][RFC2673] 0 1 1 1 1 1 1 1 Reserved for future expansion. Proposed [RFC-ietf-dnsext-rfc2671bis-edns0-10] 1 0 Unallocated
    • Method Detail

      • isUncompressedName

        public static boolean isUncompressedName​(byte namePrefix)
      • isCompressedName

        public static boolean isCompressedName​(byte namePrefix)
      • readNameUsingBuffer

        public static String readNameUsingBuffer​(NetworkData buffer)
        Optimized version of the readName method, this version uses a shared buffer to prevent having to keep allocating memory for new strings. the buffers is used to store all bytes for the string and when all bytes have been found the bytes are converted into a String. NOTE: This method is not thread safe, due to the shared buffer
        Parameters:
        buffer -
        Returns:
      • readNameUsingBuffer

        public static String readNameUsingBuffer​(NetworkData buffer,
                                                 byte[] stringBuffer)
      • writeName

        public static byte[] writeName​(String name)
      • writeLabelData

        public static void writeLabelData​(String value,
                                          NetworkData buffer)