Package com.mastfrog.url
Class Label
java.lang.Object
com.mastfrog.url.Label
- All Implemented Interfaces:
URLComponent,Serializable
One Label in a
Host - i.e. one component
of an IP address or host name such as www.example.com or
192.168.2.32.- Author:
- Tim Boudreau
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAppend this component to a StringBuilder.intasInt()Deprecated.Use asInt(hex) insteadintasInt(boolean hex) Get an int value for this label, if it can be parsed, or -1 if not.booleanGet a human-readable, localized name for this part of the URL.getLabel()Get the literal label.inthashCode()booleanisEmpty()booleanisHex()booleanbooleanisValid()Determine if this component is in compliance with the RFCs governing URLs and DNS.booleanbooleanbooleanintlength()toString()
-
Constructor Details
-
Label
-
-
Method Details
-
isEmpty
public boolean isEmpty() -
length
public int length() -
toString
-
isNumeric
public boolean isNumeric() -
getLabel
Get the literal label.- Returns:
- The label
-
isHex
public boolean isHex() -
asInt
public int asInt(boolean hex) Get an int value for this label, if it can be parsed, or -1 if not.- Parameters:
hex- Whether to parse as hexadecimal- Returns:
- An int value
-
asInt
Deprecated.Use asInt(hex) insteadGet an int value for this label.- Returns:
- An integer value or -1 if the label value is not a number
-
isValidIpComponent
public boolean isValidIpComponent() -
isValidIpV6Component
public boolean isValidIpV6Component() -
isValidIpV4Component
public boolean isValidIpV4Component() -
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- Returns:
- True if this component is valid.
-
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
-
appendTo
Description copied from interface:URLComponentAppend this component to a StringBuilder.- Specified by:
appendToin interfaceURLComponent- Parameters:
sb- A StringBuilder
-
equals
-
hashCode
public int hashCode()
-