Package com.rabbitmq.client
Class Address
java.lang.Object
com.rabbitmq.client.Address
- Direct Known Subclasses:
ResolvedInetAddress
A representation of network addresses, i.e. host/port pairs,
with some utility functions for parsing address strings.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getHost()
Get the host nameint
getPort()
Get the port numberint
hashCode()
static boolean
isHostWithPort
(String addressString) static Address
parseAddress
(String addressString) Factory method: takes a formatted addressString string as construction parameterstatic Address[]
parseAddresses
(String addresses) Array-based factory method: takes an array of formatted address strings as construction parameterstatic String
Extracts hostname or IP address from a string containing a hostname, IP address, hostname:port pair or IP address:port pair.static int
toInetSocketAddress
(int port) Construct an InetSocketAddress for this address with a specific porttoString()
-
Constructor Details
-
Address
Construct an address from a host name and port number.- Parameters:
host
- the host nameport
- the port number
-
Address
Construct an address from a host.- Parameters:
host
- the host name
-
-
Method Details
-
getHost
Get the host name- Returns:
- the host name
-
getPort
public int getPort()Get the port number- Returns:
- the port number
-
parseHost
Extracts hostname or IP address from a string containing a hostname, IP address, hostname:port pair or IP address:port pair. Note that IPv6 addresses must be quoted with square brackets, e.g. [2001:db8:85a3:8d3:1319:8a2e:370:7348].- Parameters:
addressString
- the string to extract hostname from- Returns:
- the hostname or IP address
-
parsePort
-
isHostWithPort
-
parseAddress
Factory method: takes a formatted addressString string as construction parameter- Parameters:
addressString
- an addressString of the form "host[:port]".- Returns:
- an
Address
from the given data
-
toInetSocketAddress
Construct an InetSocketAddress for this address with a specific port -
parseAddresses
Array-based factory method: takes an array of formatted address strings as construction parameter- Parameters:
addresses
- array of strings of form "host[:port],..."- Returns:
- a list of
Address
values
-
hashCode
public int hashCode() -
equals
-
toString
-