Package org.minidns.dnslabel
Class DnsLabel
- java.lang.Object
-
- org.minidns.dnslabel.DnsLabel
-
- All Implemented Interfaces:
CharSequence,Comparable<DnsLabel>
- Direct Known Subclasses:
LdhLabel,NonLdhLabel
public abstract class DnsLabel extends Object implements CharSequence, Comparable<DnsLabel>
A DNS label is an individual component of a DNS name. Labels are usually shown separated by dots.This class implements
Comparablewhich 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.
- Author:
- Florian Schmaus
- See Also:
- RFC 5890 § 2.2. DNS-Related Terminology
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDnsLabel.LabelToLongException
-
Field Summary
Fields Modifier and Type Field Description Stringlabelstatic intMAX_LABEL_LENGTH_IN_OCTETSThe maximum length of a DNS label in octets.static booleanVALIDATEWhether or not the DNS label is validated on construction.static DnsLabelWILDCARD_LABEL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DnsLabelasLowercaseVariant()charcharAt(int index)intcompareTo(DnsLabel other)booleanequals(Object other)static DnsLabelfrom(String label)static DnsLabel[]from(String[] labels)StringgetInternationalizedRepresentation()protected StringgetInternationalizedRepresentationInternal()StringgetLabelType()inthashCode()static booleanisIdnAcePrefixed(String string)intlength()CharSequencesubSequence(int start, int end)StringtoString()voidwriteToBoas(ByteArrayOutputStream byteArrayOutputStream)-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.CharSequence
chars, codePoints
-
-
-
-
Field Detail
-
MAX_LABEL_LENGTH_IN_OCTETS
public static final int MAX_LABEL_LENGTH_IN_OCTETS
The maximum length of a DNS label in octets.- See Also:
- RFC 1035 § 2.3.4., Constant Field Values
-
WILDCARD_LABEL
public static final DnsLabel WILDCARD_LABEL
-
VALIDATE
public static boolean VALIDATE
Whether or not the DNS label is validated on construction.
-
label
public final String label
-
-
Constructor Detail
-
DnsLabel
protected DnsLabel(String label)
-
-
Method Detail
-
getInternationalizedRepresentation
public final String getInternationalizedRepresentation()
-
getInternationalizedRepresentationInternal
protected String getInternationalizedRepresentationInternal()
-
getLabelType
public final String getLabelType()
-
length
public final int length()
- Specified by:
lengthin interfaceCharSequence
-
charAt
public final char charAt(int index)
- Specified by:
charAtin interfaceCharSequence
-
subSequence
public final CharSequence subSequence(int start, int end)
- Specified by:
subSequencein interfaceCharSequence
-
toString
public final String toString()
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
asLowercaseVariant
public final DnsLabel asLowercaseVariant()
-
writeToBoas
public final void writeToBoas(ByteArrayOutputStream byteArrayOutputStream)
-
compareTo
public final int compareTo(DnsLabel other)
- Specified by:
compareToin interfaceComparable<DnsLabel>
-
isIdnAcePrefixed
public static boolean isIdnAcePrefixed(String string)
-
-