Package com.iizix
Class HostNameOrAddress
java.lang.Object
com.iizix.HostNameOrAddress
The host name and/or IP address, used to look-up region location information.
- Author:
- Christopher Mindus
- Constructor SummaryConstructorsConstructorDescription- HostNameOrAddress- (String host) Constructs the region location from a host name or IP address (version 4 or 6).- HostNameOrAddress- (InetAddress address) Constructs the region location from an IP address (version 4 or 6).
- Method Summary
- Constructor Details- HostNameOrAddressConstructs the region location from an IP address (version 4 or 6).- Parameters:
- address- The IPv4/IPv6 address.
- Throws:
- NullPointerException- If- addressis null.
 
- HostNameOrAddressConstructs the region location from a host name or IP address (version 4 or 6).- Parameters:
- host- The host name or IPv4/IPv6 address.
- Throws:
- NullPointerException- If- hostNameis null.
- UnknownHostException- If- hostName InetAddresscannot be determined.
 
 
- Method Details- getHostGets the host name or address.- Returns:
- The host address if this instance was constructed from an {@link InetAddress}, otherwise the original host name or address as specified in the constructor.
 
- getAddressGets the address.- Returns:
- The InetAddress as IPv4 or IPv6 instance.
 
- toStringCreates a string representation of the instance.
- hashCodepublic int hashCode()Returns the hashCode.
- equalsChecks if two region locations object are equal.- Consider the following code: - HostNameOrAddress h1 = new HostNameOrAddress("dns.google"); HostNameOrAddress h2 = new HostNameOrAddress("8.8.8.8"); InetAddress dnsGoogle = InetAddress.getByName("8.8.8.8"); HostNameOrAddress h3 = new HostNameOrAddress(dnsGoogle);- The instances - h2equals- h3, but neither- h2or- h3equals- h1.