public class Address extends Object
Constructor and Description |
---|
Address(String host)
Construct an address from a host.
|
Address(String host,
int port)
Construct an address from a host name and port number.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getHost()
Get the host name
|
int |
getPort()
Get the port number
|
int |
hashCode() |
static boolean |
isHostWithPort(String addressString) |
static Address |
parseAddress(String addressString)
Factory method: takes a formatted addressString string as construction parameter
|
static Address[] |
parseAddresses(String addresses)
Array-based factory method: takes an array of formatted address strings as construction parameter
|
static String |
parseHost(String addressString)
Extracts hostname or IP address from a string containing a hostname, IP address,
hostname:port pair or IP address:port pair.
|
static int |
parsePort(String addressString) |
InetSocketAddress |
toInetSocketAddress(int port)
Construct an InetSocketAddress for this address with a specific port
|
String |
toString() |
public Address(String host, int port)
host
- the host nameport
- the port numberpublic Address(String host)
host
- the host namepublic String getHost()
public int getPort()
public static String parseHost(String addressString)
addressString
- the string to extract hostname frompublic static int parsePort(String addressString)
public static boolean isHostWithPort(String addressString)
public static Address parseAddress(String addressString)
addressString
- an addressString of the form "host[:port]".Address
from the given datapublic InetSocketAddress toInetSocketAddress(int port)
public static Address[] parseAddresses(String addresses)
addresses
- array of strings of form "host[:port],..."Address
valuesCopyright © 2022 VMware, Inc. or its affiliates.. All rights reserved.