| Modifier and Type | Field and Description |
|---|---|
| public static final Inet4Address | INET4_ANY
The "any" address for IPv4. |
| public static final Inet4Address | INET4_BROADCAST
The broadcast-all address for IPv4. |
| public static final Inet4Address | INET4_LOOPBACK
The traditional loopback address for IPv4. |
| public static final Inet6Address | INET6_ANY
The "any" address for IPv6. |
| public static final Inet6Address | INET6_LOOPBACK
The loopback address for IPv6. |
| private static final Pattern |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static NetworkInterface | |
| public static < the type of the T extends InetAddress> TInetAddress to search for | Returns: the resolved address (notnull)the host name to resolve (must not be hostName, Class<T> null)the class of the addressType)InetAddress to search for (must not be null)Resolve the given host name, returning the first answer with the given address type. |
| public static < the type of the T extends InetAddress> T[]InetAddress to search for | Returns: the resolved addresses (notnull)the host name to resolve (must not be hostName, Class<T> null)the class of the addressType)InetAddress to search for (must not be null)Resolve the given host name, returning all answers with the given address type. |
| public static String | Returns: the host name, ornull if the address has no host name and is unresolvedthe address to check (must not be inetAddress)null)Get the host name of the given address, if it is resolved. |
| public static String | Returns: the host name, ornull if the address has no host name and is unresolvedthe socket address to check (must not be socketAddress)null)Get the host name of the given address, if it is resolved. |
| public static Inet4Address | Returns: the address (notnull)the first segment s1, int the second segment s2, int the third segment s3, int the fourth segment s4)Get an IPv4 address from four integer segments. |
| public static Inet6Address | Returns: the address (notnull)the first segment s1, int the second segment s2, int the third segment s3, int the fourth segment s4, int the fifth segment s5, int the sixth segment s6, int the seventh segment s7, int the eighth segment s8)Get an IPv6 address from eight integer segments. |
| public static ProtocolFamily | Returns: the protocol family (notnull)the address (must not be inetAddress)null)Get the protocol family of the given Internet address. |
| public static InetSocketAddress | Returns: the socket address, ornull if the URI does not have a host componentthe URI (must not be uri, int null)the default port to use if none is given (must be in the range defaultPort, Class<? extends InetAddress> 1 ≤ n ≤ 65535the class of the addressType)InetAddress to search for (must not be null)Get a resolved socket address from the given URI. |
| public static InetSocketAddress | Returns: the socket address, ornull if the URI does not have a host componentthe URI (must not be uri, int null)the default port to use if none is given (must be in the range defaultPort)1 ≤ n ≤ 65535Get the resolved socket address from the given URI. |
| public static InetSocketAddress | Returns: the resolved address (notnull)the (possibly unresolved) address (must not be address)null)Get a copy of the given socket address, but with a resolved address component. |
| public static InetSocketAddress | Returns: the resolved address (notnull)the (possibly unresolved) address (must not be address, Class<? extends InetAddress> null)the class of the addressType)InetAddress to search for (must not be null)Get a copy of the given socket address, but with a resolved address component of the given type. |
| public static < the type of the T extends InetAddress> TInetAddress to search for | Returns: the address, ornull if no authority is present in the URIthe destination URI uri, Class<T> addressType)Get an Internet address for a URI destination, resolving the host name if necessary. |
| public static InetAddress | Returns: the address, ornull if no authority is present in the URIthe destination URI uri)Get an Internet address for a URI destination, resolving the host name if necessary. |
| public static int | Returns: the scope ID, or 0 if there is none or the address is an IPv4 addressGet the scope ID of the given address (if it is an IPv6 address). |
| public static int | Returns: the scope ID, or 0 if no matching scope could be foundthe scope number or name as a string (must not be scopeName)null)Attempt to get the scope ID of the given string. |
| public static int | Returns: the scope ID, or 0 if no matching scope could be foundthe scope number or name as a string (must not be scopeName, InetAddress null)the address to compare with, to ensure that the wrong local scope is not selected (may be compareWith)null)Attempt to get the scope ID of the given string. |
| public static int | |
| public static int | |
| public static URI | Returns: the URI instancethe URI scheme scheme, InetSocketAddress the host socket address socketAddress, int the protocol default port, or -1 if there is none defaultPort)Extract a base URI from the given scheme and socket address. |
| public static boolean | Returns: true if address is a valid IPv4 address, false otherwiseaddress textual representation address)Checks whether given String is a valid IPv4 address. |
| public static boolean | Returns: true if address is a valid IPv6 address, false otherwiseaddress textual representation address)Checks whether given String is a valid IPv6 address. |
| public static CidrAddress | Returns: the parsed address, ornull if the address is not validthe address to parse address)Parse a CIDR address into a |
| private static byte | |
| private static short | |
| public static Inet4Address | Returns: the parsed address, ornull if the address is not validthe address to parse address)Parse an IPv4 address into an |
| public static Inet4Address | Returns: the parsed address, ornull if the address is not validthe address to parse address, String the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IPv4 address into an |
| public static Inet4Address | Returns: the parsed address (notnull)the address to parse address)Parse an IPv4 address into an |
| public static Inet4Address | Returns: the parsed address (notnull)the address to parse (must not be address, String null)the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IPv4 address into an |
| public static byte[] | Returns: byte array representing the address, ornull if the address is not validaddress textual representation address)Converts IPv4 address from textual representation to bytes. |
| public static Inet6Address | Returns: the parsed address, ornull if the address is not validthe address to parse address)Parse an IPv6 address into an |
| public static Inet6Address | Returns: the parsed address, ornull if the address is not validthe address to parse (must not be address, String null)the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IPv6 address into an |
| public static Inet6Address | Returns: the parsed address (notnull)the address to parse address)Parse an IPv6 address into an |
| public static Inet6Address | Returns: the parsed address (notnull)the address to parse (must not be address, String null)the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IPv6 address into an |
| public static byte[] | Returns: byte array representing the address, ornull if the address is not validaddress textual representation address)Converts IPv6 address from textual representation to bytes. |
| public static InetAddress | Returns: the parsed address, ornull if the address is not validthe address to parse address)Parse an IP address into an |
| public static InetAddress | Returns: the parsed address, ornull if the address is not validthe address to parse address, String the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IP address into an |
| public static InetAddress | Returns: the parsed address (notnull)the address to parse address)Parse an IP address into an |
| public static InetAddress | Returns: the parsed address (notnull)the address to parse (must not be address, String null)the host name to use in the resultant object, or hostName)null to use the string representation of
the addressParse an IP address into an |
| public static byte[] | Returns: byte array representing the address, ornull if the address is not validaddress textual representation address)Converts an IP address from textual representation to bytes. |
| public static Inet6Address | Returns: the converted address (notnull)the address to convert (must not be inetAddress)null)Get the IPv6 equivalent of the given address. |
| public static String | Returns: the string representation (notnull)the address (must not be inetAddress)null)Get the optimal string representation of an IP address. |
| public static String | Returns: the string representation (notnull)the address bytes (must not be addressBytes)null)Get the optimal string representation of the bytes of an IP address. |
| private static String | |
| public static String | Returns: the string representation (notnull)the address (must not be inetAddress, boolean null)true to preserve the host name string in the address, false to always give
an IP address stringGet a string representation of the given address which is suitable for use as the host component of a URL. |
| public static String | Returns: the string representation (notnull)the address bytes (must not be addressBytes)null)Get a string representation of the given address bytes which is suitable for use as the host component of a URL. |
| INET4_ANY | back to summary |
|---|---|
| public static final Inet4Address INET4_ANY The "any" address for IPv4. | |
| INET4_BROADCAST | back to summary |
|---|---|
| public static final Inet4Address INET4_BROADCAST The broadcast-all address for IPv4. | |
| INET4_LOOPBACK | back to summary |
|---|---|
| public static final Inet4Address INET4_LOOPBACK The traditional loopback address for IPv4. | |
| INET6_ANY | back to summary |
|---|---|
| public static final Inet6Address INET6_ANY The "any" address for IPv6. | |
| INET6_LOOPBACK | back to summary |
|---|---|
| public static final Inet6Address INET6_LOOPBACK The loopback address for IPv6. | |
| NUMERIC | back to summary |
|---|---|
| private static final Pattern NUMERIC | |
| Inet | back to summary |
|---|---|
| private Inet() | |
| findInterfaceWithScopeId | back to summary |
|---|---|
| public static NetworkInterface findInterfaceWithScopeId(String scopeName) | |
| getAddressByNameAndType | back to summary |
|---|---|
| public static <T extends InetAddress> T getAddressByNameAndType(String hostName, Class<T> addressType) throws UnknownHostException Resolve the given host name, returning the first answer with the given address type.
| |
| getAllAddressesByNameAndType | back to summary |
|---|---|
| public static <T extends InetAddress> T[] getAllAddressesByNameAndType(String hostName, Class<T> addressType) throws UnknownHostException Resolve the given host name, returning all answers with the given address type.
| |
| getHostNameIfResolved | back to summary |
|---|---|
| public static String getHostNameIfResolved(InetAddress inetAddress) Get the host name of the given address, if it is resolved. Otherwise, return
| |
| getHostNameIfResolved | back to summary |
|---|---|
| public static String getHostNameIfResolved(InetSocketAddress socketAddress) Get the host name of the given address, if it is resolved. Otherwise, return
| |
| getInet4Address | back to summary |
|---|---|
| public static Inet4Address getInet4Address(int s1, int s2, int s3, int s4) Get an IPv4 address from four integer segments. Each segment must be between 0 and 255.
| |
| getInet6Address | back to summary |
|---|---|
| public static Inet6Address getInet6Address(int s1, int s2, int s3, int s4, int s5, int s6, int s7, int s8) Get an IPv6 address from eight integer segments. Each segment must be between 0 and 65535 (
| |
| getProtocolFamily | back to summary |
|---|---|
| public static ProtocolFamily getProtocolFamily(InetAddress inetAddress) Get the protocol family of the given Internet address.
| |
| getResolved | back to summary |
|---|---|
| public static InetSocketAddress getResolved(URI uri, int defaultPort, Class<? extends InetAddress> addressType) throws UnknownHostException Get a resolved socket address from the given URI.
| |
| getResolved | back to summary |
|---|---|
| public static InetSocketAddress getResolved(URI uri, int defaultPort) throws UnknownHostException Get the resolved socket address from the given URI.
| |
| getResolved | back to summary |
|---|---|
| public static InetSocketAddress getResolved(InetSocketAddress address) throws UnknownHostException Get a copy of the given socket address, but with a resolved address component.
| |
| getResolved | back to summary |
|---|---|
| public static InetSocketAddress getResolved(InetSocketAddress address, Class<? extends InetAddress> addressType) throws UnknownHostException Get a copy of the given socket address, but with a resolved address component of the given type.
| |
| getResolvedInetAddress | back to summary |
|---|---|
| public static <T extends InetAddress> T getResolvedInetAddress(URI uri, Class<T> addressType) throws UnknownHostException Get an Internet address for a URI destination, resolving the host name if necessary.
| |
| getResolvedInetAddress | back to summary |
|---|---|
| public static InetAddress getResolvedInetAddress(URI uri) throws UnknownHostException Get an Internet address for a URI destination, resolving the host name if necessary.
| |
| getScopeId | back to summary |
|---|---|
| public static int getScopeId(InetAddress address) Get the scope ID of the given address (if it is an IPv6 address).
| |
| getScopeId | back to summary |
|---|---|
| public static int getScopeId(String scopeName) Attempt to get the scope ID of the given string. If the string is numeric then the number is parsed and returned as-is. If the scope is a string, then a search for the matching network interface will occur.
| |
| getScopeId | back to summary |
|---|---|
| public static int getScopeId(String scopeName, InetAddress compareWith) Attempt to get the scope ID of the given string. If the string is numeric then the number is parsed and returned as-is. If the scope is a string, then a search for the matching network interface will occur.
| |
| getScopeId | back to summary |
|---|---|
| public static int getScopeId(NetworkInterface networkInterface) | |
| getScopeId | back to summary |
|---|---|
| public static int getScopeId(NetworkInterface networkInterface, InetAddress compareWith) | |
| getURIFromAddress | back to summary |
|---|---|
| public static URI getURIFromAddress(String scheme, InetSocketAddress socketAddress, int defaultPort) throws URISyntaxException Extract a base URI from the given scheme and socket address. The address is not resolved.
| |
| isInet4Address | back to summary |
|---|---|
| public static boolean isInet4Address(String address) Checks whether given String is a valid IPv4 address.
| |
| isInet6Address | back to summary |
|---|---|
| public static boolean isInet6Address(String address) Checks whether given String is a valid IPv6 address.
| |
| parseCidrAddress | back to summary |
|---|---|
| public static CidrAddress parseCidrAddress(String address) Parse a CIDR address into a
| |
| parseDecimal | back to summary |
|---|---|
| private static byte parseDecimal(String number) | |
| parseHexadecimal | back to summary |
|---|---|
| private static short parseHexadecimal(String hexNumber) | |
| parseInet4Address | back to summary |
|---|---|
| public static Inet4Address parseInet4Address(String address) Parse an IPv4 address into an
| |
| parseInet4Address | back to summary |
|---|---|
| public static Inet4Address parseInet4Address(String address, String hostName) Parse an IPv4 address into an
| |
| parseInet4AddressOrFail | back to summary |
|---|---|
| public static Inet4Address parseInet4AddressOrFail(String address) Parse an IPv4 address into an
| |
| parseInet4AddressOrFail | back to summary |
|---|---|
| public static Inet4Address parseInet4AddressOrFail(String address, String hostName) Parse an IPv4 address into an
| |
| parseInet4AddressToBytes | back to summary |
|---|---|
| public static byte[] parseInet4AddressToBytes(String address) Converts IPv4 address from textual representation to bytes.
If given string doesn't represent valid IPv4 address, the method returns This only supports decimal notation.
| |
| parseInet6Address | back to summary |
|---|---|
| public static Inet6Address parseInet6Address(String address) Parse an IPv6 address into an
| |
| parseInet6Address | back to summary |
|---|---|
| public static Inet6Address parseInet6Address(String address, String hostName) Parse an IPv6 address into an
| |
| parseInet6AddressOrFail | back to summary |
|---|---|
| public static Inet6Address parseInet6AddressOrFail(String address) Parse an IPv6 address into an
| |
| parseInet6AddressOrFail | back to summary |
|---|---|
| public static Inet6Address parseInet6AddressOrFail(String address, String hostName) Parse an IPv6 address into an
| |
| parseInet6AddressToBytes | back to summary |
|---|---|
| public static byte[] parseInet6AddressToBytes(String address) Converts IPv6 address from textual representation to bytes.
If given string doesn't represent valid IPv6 address, the method returns
| |
| parseInetAddress | back to summary |
|---|---|
| public static InetAddress parseInetAddress(String address) Parse an IP address into an
| |
| parseInetAddress | back to summary |
|---|---|
| public static InetAddress parseInetAddress(String address, String hostName) Parse an IP address into an
| |
| parseInetAddressOrFail | back to summary |
|---|---|
| public static InetAddress parseInetAddressOrFail(String address) Parse an IP address into an
| |
| parseInetAddressOrFail | back to summary |
|---|---|
| public static InetAddress parseInetAddressOrFail(String address, String hostName) Parse an IP address into an
| |
| parseInetAddressToBytes | back to summary |
|---|---|
| public static byte[] parseInetAddressToBytes(String address) Converts an IP address from textual representation to bytes.
If given string doesn't represent valid IP address, the method returns
| |
| toInet6Address | back to summary |
|---|---|
| public static Inet6Address toInet6Address(InetAddress inetAddress) Get the IPv6 equivalent of the given address. If the address is IPv4 then it is returned as a compatibility address.
| |
| toOptimalString | back to summary |
|---|---|
| public static String toOptimalString(InetAddress inetAddress) Get the optimal string representation of an IP address. For IPv6 addresses, this representation will be more compact that the default.
| |
| toOptimalString | back to summary |
|---|---|
| public static String toOptimalString(byte[] addressBytes) Get the optimal string representation of the bytes of an IP address.
| |
| toOptimalStringV6 | back to summary |
|---|---|
| private static String toOptimalStringV6(final byte[] bytes) | |
| toURLString | back to summary |
|---|---|
| public static String toURLString(InetAddress inetAddress, boolean useHostNameIfPresent) Get a string representation of the given address which is suitable for use as the host component of a URL.
| |
| toURLString | back to summary |
|---|---|
| public static String toURLString(byte[] addressBytes) Get a string representation of the given address bytes which is suitable for use as the host component of a URL.
| |