Class URIAuthority
java.lang.Object
org.apache.hc.core5.net.URIAuthority
- All Implemented Interfaces:
Serializable, NamedEndpoint
@Contract(threading=IMMUTABLE)
public final class URIAuthority
extends Object
implements NamedEndpoint, Serializable
Represents authority component of request
URI.- Since:
- 5.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionURIAuthority(String hostName) Constructs a new instance.URIAuthority(String hostName, int port) Constructs a new instance.URIAuthority(String userInfo, String hostName, int port) Constructs a new instance.URIAuthority(String userInfo, Host host) Constructs a new instance.URIAuthority(String userInfo, NamedEndpoint endpoint) Constructs a new instance.URIAuthority(Host host) Constructs a new instance.URIAuthority(NamedEndpoint namedEndpoint) Constructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic URIAuthorityCreates aURIAuthorityinstance from a string.boolean(package private) static voidformat(StringBuilder buf, URIAuthority uriAuthority) (package private) static Stringformat(URIAuthority uriAuthority) Returns name (IP or DNS name).intgetPort()Returns the port.Gets the user info String.inthashCode()(package private) static URIAuthority(package private) static URIAuthorityparse(CharSequence s, Tokenizer.Cursor cursor) toString()
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
userInfo
-
host
-
-
Constructor Details
-
URIAuthority
Constructs a new instance.- Parameters:
userInfo- The user info, may be null.hostName- The host name, not null.port- The port value, between 0 and 65535, inclusive.-1indicates the scheme default port.- Throws:
NullPointerException- If thenameisnull.IllegalArgumentException- If the port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
Constructs a new instance.- Parameters:
hostName- The host name, not null.port- The port value, between 0 and 65535, inclusive.-1indicates the scheme default port.- Throws:
NullPointerException- If thenameisnull.IllegalArgumentException- If the port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
Constructs a new instance.- Parameters:
userInfo- The user info, may be null.host- The host, never null.- Throws:
NullPointerException- if thehostisnull.- Since:
- 5.2
-
URIAuthority
Constructs a new instance.- Parameters:
host- The host, never null.- Throws:
NullPointerException- if thehostisnull.- Since:
- 5.2
-
URIAuthority
Constructs a new instance.- Parameters:
userInfo- The user info, may be null.endpoint- The named end-point, never null.- Throws:
NullPointerException- If the end-point isnull.NullPointerException- If the end-pointnameisnull.IllegalArgumentException- If the end-point port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.- Since:
- 5.2
-
URIAuthority
Constructs a new instance.- Parameters:
namedEndpoint- The named end-point, never null.- Throws:
NullPointerException- If the end-point isnull.NullPointerException- If the end-pointnameisnull.IllegalArgumentException- If the end-point port is outside the specified range of valid port values, which is between 0 and 65535, inclusive.-1indicates the scheme default port.
-
URIAuthority
Constructs a new instance.- Parameters:
hostName- The host name, not null.- Throws:
NullPointerException- If thenameisnull.
-
-
Method Details
-
parse
- Throws:
URISyntaxException
-
parse
- Throws:
URISyntaxException
-
format
-
format
-
create
Creates aURIAuthorityinstance from a string. Text may not contain any blanks.- Parameters:
s- The value to parse- Returns:
- The parsed URIAuthority.
- Throws:
URISyntaxException- Thrown if a string could not be parsed as a URIAuthority.
-
getUserInfo
-
getHostName
Description copied from interface:NamedEndpointReturns name (IP or DNS name).- Specified by:
getHostNamein interfaceNamedEndpoint- Returns:
- the host name (IP or DNS name)
-
getPort
public int getPort()Description copied from interface:NamedEndpointReturns the port.- Specified by:
getPortin interfaceNamedEndpoint- Returns:
- the host port, or
-1if not set
-
toString
-
equals
-
hashCode
-