public final class Inet
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.net.Inet4Address |
INET4_ANY
The "any" address for IPv4.
|
static java.net.Inet4Address |
INET4_BROADCAST
The broadcast-all address for IPv4.
|
static java.net.Inet4Address |
INET4_LOOPBACK
The traditional loopback address for IPv4.
|
static java.net.Inet6Address |
INET6_ANY
The "any" address for IPv6.
|
static java.net.Inet6Address |
INET6_LOOPBACK
The loopback address for IPv6.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
getHostNameIfResolved(java.net.InetAddress inetAddress)
Get the host name of the given address, if it is resolved.
|
static java.net.Inet4Address |
getInet4Address(int s1,
int s2,
int s3,
int s4)
Get an IPv4 address from four integer segments.
|
static java.net.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.
|
static boolean |
isInet6Address(java.lang.String address)
Checks whether given String is a valid IPv6 address.
|
static java.net.Inet6Address |
parseInet6Address(java.lang.String address)
Parse an IPv6 address into an
Inet6Address object. |
static byte[] |
parseInet6AddressToBytes(java.lang.String address)
Converts IPv6 address from textual representation to bytes.
|
static java.net.Inet6Address |
toInet6Address(java.net.InetAddress inetAddress)
Get the IPv6 equivalent of the given address.
|
static java.lang.String |
toOptimalString(byte[] addressBytes)
Get the optimal string representation of the bytes of an IP address.
|
static java.lang.String |
toOptimalString(java.net.InetAddress inetAddress)
Get the optimal string representation of an IP address.
|
public static final java.net.Inet4Address INET4_ANY
public static final java.net.Inet4Address INET4_LOOPBACK
public static final java.net.Inet4Address INET4_BROADCAST
public static final java.net.Inet6Address INET6_ANY
public static final java.net.Inet6Address INET6_LOOPBACK
public static java.lang.String toOptimalString(java.net.InetAddress inetAddress)
inetAddress - the address (must not be null)null)public static java.lang.String toOptimalString(byte[] addressBytes)
addressBytes - the address bytes (must not be null)null)public static java.net.Inet6Address toInet6Address(java.net.InetAddress inetAddress)
inetAddress - the address to convert (must not be null)null)public static java.lang.String getHostNameIfResolved(java.net.InetAddress inetAddress)
null.inetAddress - the address to check (must not be null)null if the address has no host name and is unresolvedpublic static java.net.Inet4Address getInet4Address(int s1,
int s2,
int s3,
int s4)
s1 - the first segments2 - the second segments3 - the third segments4 - the fourth segmentnull)public static java.net.Inet6Address getInet6Address(int s1,
int s2,
int s3,
int s4,
int s5,
int s6,
int s7,
int s8)
0xffff).s1 - the first segments2 - the second segments3 - the third segments4 - the fourth segments5 - the fifth segments6 - the sixth segments7 - the seventh segments8 - the eighth segmentnull)public static boolean isInet6Address(java.lang.String address)
address - address textual representationtrue if address is a valid IPv6 address, false otherwisepublic static java.net.Inet6Address parseInet6Address(java.lang.String address)
Inet6Address object.address - the address to parsenull if the address is not validpublic static byte[] parseInet6AddressToBytes(java.lang.String address)
If given string doesn't represent valid IPv6 address, the method returns null.
address - address textual representationnull if the address is not validCopyright © 2015 JBoss, a division of Red Hat, Inc.