Package org.minidns.dnslabel
Class DnsLabel
- java.lang.Object
-
- org.minidns.dnslabel.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DnsLabel.LabelToLongException
-
Field Summary
Fields Modifier and Type Field Description java.lang.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
Constructors Modifier Constructor Description protected
DnsLabel(java.lang.String label)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description DnsLabel
asLowercaseVariant()
char
charAt(int index)
int
compareTo(DnsLabel other)
boolean
equals(java.lang.Object other)
static DnsLabel
from(java.lang.String label)
static DnsLabel[]
from(java.lang.String[] labels)
java.lang.String
getInternationalizedRepresentation()
protected java.lang.String
getInternationalizedRepresentationInternal()
java.lang.String
getLabelType()
int
hashCode()
static boolean
isIdnAcePrefixed(java.lang.String string)
int
length()
java.lang.CharSequence
subSequence(int start, int end)
java.lang.String
toString()
void
writeToBoas(java.io.ByteArrayOutputStream byteArrayOutputStream)
-
-
-
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 java.lang.String label
-
-
Constructor Detail
-
DnsLabel
protected DnsLabel(java.lang.String label)
-
-
Method Detail
-
getInternationalizedRepresentation
public final java.lang.String getInternationalizedRepresentation()
-
getInternationalizedRepresentationInternal
protected java.lang.String getInternationalizedRepresentationInternal()
-
getLabelType
public final java.lang.String getLabelType()
-
length
public final int length()
- Specified by:
length
in interfacejava.lang.CharSequence
-
charAt
public final char charAt(int index)
- Specified by:
charAt
in interfacejava.lang.CharSequence
-
subSequence
public final java.lang.CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfacejava.lang.CharSequence
-
toString
public final java.lang.String toString()
- Specified by:
toString
in interfacejava.lang.CharSequence
- Overrides:
toString
in classjava.lang.Object
-
equals
public final boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public final int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
asLowercaseVariant
public final DnsLabel asLowercaseVariant()
-
writeToBoas
public final void writeToBoas(java.io.ByteArrayOutputStream byteArrayOutputStream)
-
compareTo
public final int compareTo(DnsLabel other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<DnsLabel>
-
isIdnAcePrefixed
public static boolean isIdnAcePrefixed(java.lang.String string)
-
-