Package com.mastfrog.url
Class Host
java.lang.Object
com.mastfrog.url.Host
- All Implemented Interfaces:
URLComponent,Serializable,Iterable<Label>,org.netbeans.validation.api.Validating
public final class Host
extends Object
implements URLComponent, org.netbeans.validation.api.Validating, Iterable<Label>
An internet host such as a host name or IP address. Validation is more
extensive than that done by java.net.URL, including checking name and label
lengths for spec compatibility (max 63 chars per label, 255 chars per host
name).
- Author:
- Tim Boudreau
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend this component to a StringBuilder.static AbstractBuilder<Label,Host> builder()booleanGet a human-readable, localized name for this part of the URL.getElement(int ix) Label[]org.netbeans.validation.api.ProblemsinthashCode()booleanbooleanbooleanbooleanbooleanbooleanisValid()Determine if this component is in compliance with the RFCs governing URLs and DNS.iterator()intlength()static Hostintsize()int[]toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Host
-
Host
-
-
Method Details
-
size
public int size() -
getElement
-
isDomain
-
parse
-
getTopLevelDomain
-
getDomain
-
getLabels
-
getParentDomain
-
isIpAddress
public boolean isIpAddress() -
isIpV4Address
public boolean isIpV4Address() -
isIpV6Address
public boolean isIpV6Address() -
length
public int length() -
isValid
public boolean isValid()Description copied from interface:URLComponentDetermine if this component is in compliance with the RFCs governing URLs and DNS.- Specified by:
isValidin interfaceURLComponent- Specified by:
isValidin interfaceorg.netbeans.validation.api.Validating- Returns:
- True if this component is valid.
-
getProblems
public org.netbeans.validation.api.Problems getProblems()- Specified by:
getProblemsin interfaceorg.netbeans.validation.api.Validating
-
builder
-
getComponentName
Description copied from interface:URLComponentGet a human-readable, localized name for this part of the URL. Useful if an error message needs to be shown.- Specified by:
getComponentNamein interfaceURLComponent- Returns:
- The component name
-
toString
-
appendTo
Description copied from interface:URLComponentAppend this component to a StringBuilder.- Specified by:
appendToin interfaceURLComponent- Parameters:
sb- A StringBuilder
-
equals
-
isLocalhost
public boolean isLocalhost() -
hashCode
public int hashCode() -
canonicalize
-
iterator
-
toIntArray
public int[] toIntArray()
-