public abstract class DnsLabel extends SafeCharSequence implements Comparable<DnsLabel>
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.
| Modifier and Type | Class and Description |
|---|---|
static class | DnsLabel.LabelToLongExceptionThrown when a DNS label exceeds the maximum length. |
| Modifier and Type | Field and Description |
|---|---|
String | labelThe label string. |
static int | MAX_LABEL_LENGTH_IN_OCTETSThe maximum length of a DNS label in octets. |
static DnsLabel | WILDCARD_LABELThe wildcard label. |
| Modifier | Constructor and Description |
|---|---|
protected | DnsLabel(String label)DnsLabel. |
| Modifier and Type | Method and Description |
|---|---|
DnsLabel | asLowercaseVariant()Get the lowercase variant of this label. |
int | compareTo(DnsLabel other)compareTo. |
static boolean | consistsOnlyOfLettersDigitsAndHypen(String string)Check if a string consists of only letters, digits, and hyphens. |
static boolean | consistsOnlyOfLettersDigitsHypenAndUnderscore(String string)Check if a string consists of only letters, digits, hyphens, and underscores. |
boolean | equals(Object other)equals. |
static DnsLabel | from(String label)Create a DnsLabel from a string. |
static DnsLabel[] | from(String[] labels)Create DnsLabel array from string array. |
String | getInternationalizedRepresentation()Get the internationalized representation of this label. |
protected String | getInternationalizedRepresentationInternal()Gets the internal internationalized representation. |
String | getLabelType()Get the type of this label. |
String | getRawLabel()Get the raw label. |
int | hashCode()hashCode. |
static boolean | isIdnAcePrefixed(String string)Check if a string has the IDN ACE prefix. |
static String | toSafeRepesentation(String dnsLabel)Convert a DNS label string to a safe representation. |
String | toString()toString. |
void | writeToBoas(ByteArrayOutputStream byteArrayOutputStream)Write this label to a ByteArrayOutputStream prefixed by its length. |
charAt, length, subSequence, toSafeStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitchars, codePointspublic final String label
public static final int MAX_LABEL_LENGTH_IN_OCTETS
public static final DnsLabel WILDCARD_LABEL
protected DnsLabel(String label)
public final DnsLabel asLowercaseVariant()
public final int compareTo(DnsLabel other)
compareTo in interface Comparable<DnsLabel>public static boolean consistsOnlyOfLettersDigitsAndHypen(String string)
string - the string to checkpublic static boolean consistsOnlyOfLettersDigitsHypenAndUnderscore(String string)
string - the string to checkpublic static DnsLabel from(String label)
label - the label stringpublic static DnsLabel[] from(String[] labels)
labels - the label stringspublic final String getInternationalizedRepresentation()
protected String getInternationalizedRepresentationInternal()
public final String getLabelType()
public final String getRawLabel()
toString() instead,
which will return a sanitized String.public static boolean isIdnAcePrefixed(String string)
string - the string to checkpublic static String toSafeRepesentation(String dnsLabel)
dnsLabel - the label to convertpublic final String toString()
toString in interface CharSequencetoString in class Objectpublic final void writeToBoas(ByteArrayOutputStream byteArrayOutputStream)
byteArrayOutputStream - the output stream to write to