Class DnsLabel

  • All Implemented Interfaces:
    java.lang.CharSequence, java.lang.Comparable<DnsLabel>
    Direct Known Subclasses:
    LdhLabel, NonLdhLabel

    public abstract class DnsLabel
    extends java.lang.Object
    implements java.lang.CharSequence, java.lang.Comparable<DnsLabel>
    A DNS label is an individual component of a DNS name. Labels are usually shown separated by dots.

    This class implements Comparable which compares DNS labels according to the Canonical DNS Name Order as specified in RFC 4034 § 6.1.

    Note that as per RFC 2181 § 11 DNS labels may contain any byte.

    See Also:
    RFC 5890 § 2.2. DNS-Related Terminology
    • Constructor Detail

      • DnsLabel

        protected DnsLabel​(java.lang.String label)
    • Method Detail

      • getLabelType

        public final java.lang.String getLabelType()
      • length

        public final int length()
        Specified by:
        length in interface java.lang.CharSequence
      • charAt

        public final char charAt​(int index)
        Specified by:
        charAt in interface java.lang.CharSequence
      • subSequence

        public final java.lang.CharSequence subSequence​(int start,
                                                        int end)
        Specified by:
        subSequence in interface java.lang.CharSequence
      • toString

        public final java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class java.lang.Object
      • equals

        public final boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • writeToBoas

        public final void writeToBoas​(java.io.ByteArrayOutputStream byteArrayOutputStream)
      • compareTo

        public final int compareTo​(DnsLabel other)
        Specified by:
        compareTo in interface java.lang.Comparable<DnsLabel>
      • from

        public static DnsLabel from​(java.lang.String label)
      • from

        public static DnsLabel[] from​(java.lang.String[] labels)
      • isIdnAcePrefixed

        public static boolean isIdnAcePrefixed​(java.lang.String string)