java.lang.Object
org.minidns.util.SafeCharSequence
org.minidns.dnslabel.DnsLabel
org.minidns.dnslabel.LdhLabel
- All Implemented Interfaces:
CharSequence, Comparable<DnsLabel>
- Direct Known Subclasses:
NonReservedLdhLabel, ReservedLdhLabel
A LDH (Letters, Digits, Hyphen) label, which is the classical label form.
Note that it is a common misconception that LDH labels can not start with a digit. The origin of this misconception is likely that RFC 1034 § 3.5 specified
They [i.e, DNS labels] must start with a letter, end with a letter or digit, and have as interior characters only letters, digits, and hyphen.However, this was relaxed in RFC 1123 § 2.1
One aspect of host name syntax is hereby changed: the restriction on the first character is relaxed to allow either a letter or a digit.and later summarized in RFC 3696 § 2:
If the hyphen is used, it is not permitted to appear at either the beginning or end of a label.Furthermore RFC 5890 § 2.3.1 only mentions the requirement that hyphen must not be the first or last character of a LDH label.
- See Also:
Nested Class Summary
Nested classes/interfaces inherited from class DnsLabel
DnsLabel.LabelToLongExceptionModifier and TypeClassDescriptionstatic classThrown when a DNS label exceeds the maximum length.Field Summary
Fields inherited from class DnsLabel
label, MAX_LABEL_LENGTH_IN_OCTETS, WILDCARD_LABELConstructor Summary
Method Summary
Public MethodsModifier and TypeMethodDescriptionprotected static LdhLabelfromInternal(String label) Creates an LdhLabel from internal representationstatic booleanisLdhLabel(String label) Determine if the given label is an LDH (letters, digits, hyphen) label.Methods inherited from class DnsLabel
asLowercaseVariant, compareTo, consistsOnlyOfLettersDigitsAndHypen, consistsOnlyOfLettersDigitsHypenAndUnderscore, equals, from, from, getInternationalizedRepresentation, getInternationalizedRepresentationInternal, getLabelType, getRawLabel, hashCode, isIdnAcePrefixed, toSafeRepesentation, toString, writeToBoasModifier and TypeMethodDescriptionfinal DnsLabelGet the lowercase variant of this label.final intOrder labels case-insensitively, ignoring letter case.static booleanCheck if a string consists of only letters, digits, and hyphens.static booleanCheck if a string consists of only letters, digits, hyphens, and underscores.final booleanCompare the label text against another label.static DnsLabelCreate a DnsLabel from a string.static DnsLabel[]Create DnsLabel array from string array.final StringGet the internationalized representation of this label.protected StringGets the internal internationalized representation.final StringGet the type of this label.final StringGet the raw label.final inthashCode()Hash the label text.static booleanisIdnAcePrefixed(String string) Check if a string has the IDN ACE prefix.static StringtoSafeRepesentation(String dnsLabel) Convert a DNS label string to a safe representation.final StringtoString()Render the label with every character outside the LDH set escaped.final voidwriteToBoas(ByteArrayOutputStream byteArrayOutputStream) Write this label to a ByteArrayOutputStream prefixed by its length.Methods inherited from class SafeCharSequence
charAt, length, subSequence, toSafeStringModifier and TypeMethodDescriptionfinal charcharAt(int index) Returns one character of the safe string form.final intlength()Counts the characters of the safe string form.final CharSequencesubSequence(int start, int end) Returns a safe substring of the safe string form.Return a safe string representation.Methods inherited from interface CharSequence
chars, codePoints, getChars, isEmpty
Constructor Details
LdhLabel
Method Details
isLdhLabel
Determine if the given label is an LDH (letters, digits, hyphen) label.- Parameters:
label- the label to check- Returns:
- true if the label is an LDH label
fromInternal