Package com.rabbitmq.client
Class Address
- java.lang.Object
-
- com.rabbitmq.client.Address
-
public class Address extends Object
A representation of network addresses, i.e. host/port pairs, with some utility functions for parsing address strings.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
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
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)
String
toString()
-
-
-
Method Detail
-
getHost
public String getHost()
Get the host name- Returns:
- the host name
-
getPort
public int getPort()
Get the port number- Returns:
- the port number
-
parseHost
public 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. 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
public static int parsePort(String addressString)
-
isHostWithPort
public static boolean isHostWithPort(String addressString)
-
parseAddress
public static Address parseAddress(String addressString)
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
-
parseAddresses
public static Address[] parseAddresses(String addresses)
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
-
-