Package uk.ac.manchester.spinnaker.utils
Class InetFactory
java.lang.Object
uk.ac.manchester.spinnaker.utils.InetFactory
Convenience methods for creating IPv4 Addresses.
- Author:
- Christian-B
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classSpecific Exception to show IPv6 is not supported.
- 
Method SummaryModifier and TypeMethodDescriptionstatic Inet4AddressgetByAddress(byte[] addr) Creates a IPv4 address from the bytes representing the raw address.static Inet4AddressgetByAddressQuietly(byte[] addr) Creates a IPv4 address from the bytes representing the raw address.static Inet4AddressCreates a IPv4 address from a host name.static Inet4AddressgetByNameQuietly(String host) Creates a IPv4 address from a host name.
- 
Method Details- 
getByAddresspublic static Inet4Address getByAddress(byte[] addr) throws UnknownHostException, InetFactory.Inet6NotSupportedException Creates a IPv4 address from the bytes representing the raw address.- Parameters:
- addr- An array of bytes of length 4
- Returns:
- addras an IPv4 address
- Throws:
- InetFactory.Inet6NotSupportedException- If the- addrwould translate to a valid IPv6 address; this is not supported by Spinnaker
- UnknownHostException- if IP address is of illegal length
 
- 
getByAddressQuietlyCreates a IPv4 address from the bytes representing the raw address.- Parameters:
- addr- An array of bytes of length 4
- Returns:
- addras an IPv4 address
- Throws:
- RuntimeException- if IP address is of illegal length or otherwise isn't supported.
 
- 
getByNamepublic static Inet4Address getByName(String host) throws UnknownHostException, InetFactory.Inet6NotSupportedException Creates a IPv4 address from a host name.- Parameters:
- host- the specified host name
- Returns:
- hostas an IPv4 address
- Throws:
- InetFactory.Inet6NotSupportedException- If the- hostwould translate to a valid IPv6 address; this is not supported by Spinnaker
- UnknownHostException- if no IP address for the host could be found, or if a scope_id was specified for a global IPv6 address.
 
- 
getByNameQuietlyCreates a IPv4 address from a host name.- Parameters:
- host- the specified host name
- Returns:
- hostas an IPv4 address
- Throws:
- RuntimeException- if IP address is isn't supported as an IPv4 address.
 
 
-