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 booleanequals(Object obj)StringgetHost()Get the host nameintgetPort()Get the port numberinthashCode()static booleanisHostWithPort(String addressString)static AddressparseAddress(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 StringparseHost(String addressString)Extracts hostname or IP address from a string containing a hostname, IP address, hostname:port pair or IP address:port pair.static intparsePort(String addressString)StringtoString()
-
-
-
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
Addressfrom 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
Addressvalues
-
-