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 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.
- Author:
- Florian Schmaus
- See Also:
- RFC 5890 § 2.2. DNS-Related Terminology
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DnsLabel.LabelToLongException
-
Field Summary
Fields Modifier and Type Field Description String
label
static int
MAX_LABEL_LENGTH_IN_OCTETS
The maximum length of a DNS label in octets.static boolean
VALIDATE
Whether or not the DNS label is validated on construction.static DnsLabel
WILDCARD_LABEL
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description DnsLabel
asLowercaseVariant()
char
charAt(int index)
int
compareTo(DnsLabel other)
boolean
equals(Object other)
static DnsLabel
from(String label)
static DnsLabel[]
from(String[] labels)
String
getInternationalizedRepresentation()
protected String
getInternationalizedRepresentationInternal()
String
getLabelType()
int
hashCode()
static boolean
isIdnAcePrefixed(String string)
int
length()
CharSequence
subSequence(int start, int end)
String
toString()
void
writeToBoas(ByteArrayOutputStream byteArrayOutputStream)
-
Field Details
-
MAX_LABEL_LENGTH_IN_OCTETS
public static final int MAX_LABEL_LENGTH_IN_OCTETSThe maximum length of a DNS label in octets.- See Also:
- RFC 1035 § 2.3.4., Constant Field Values
-
WILDCARD_LABEL
-
VALIDATE
public static boolean VALIDATEWhether or not the DNS label is validated on construction. -
label
-
-
Constructor Details
-
Method Details
-
getInternationalizedRepresentation
-
getInternationalizedRepresentationInternal
-
getLabelType
-
length
public final int length()- Specified by:
length
in interfaceCharSequence
-
charAt
public final char charAt(int index)- Specified by:
charAt
in interfaceCharSequence
-
subSequence
- Specified by:
subSequence
in interfaceCharSequence
-
toString
- Specified by:
toString
in interfaceCharSequence
- Overrides:
toString
in classObject
-
equals
-
hashCode
public final int hashCode() -
asLowercaseVariant
-
writeToBoas
-
compareTo
- Specified by:
compareTo
in interfaceComparable<DnsLabel>
-
from
-
from
-
isIdnAcePrefixed
-