public final class Util extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
appendHostAddress(StringBuilder sbuf,
InetAddress addr)
Even faster version than
getHostAddress(java.net.InetAddress) when the address is not
the only piece of information put in the string. |
static String |
getHostAddress(InetAddress addr)
Faster version than
InetAddress.getHostAddress(). |
static int |
inetAddress2Int(InetAddress addr)
Converts IPv4
InetAddress to 32 bits int. |
static long |
inetAddress2Long(InetAddress addr)
Converts IPv4
InetAddress to 32 bits int, packages into a 64
bits long. |
static InetAddress |
int2InetAddress(int val)
Converts 32 bits int to IPv4
InetAddress. |
static InetAddress |
long2InetAddress(long val)
Converts 32 bits int packaged into a 64bits long to IPv4
InetAddress. |
static byte[] |
stringToBytes(String str) |
public static byte[] stringToBytes(String str)
public static final InetAddress int2InetAddress(int val)
InetAddress.val - int representation of IPv4 addresspublic static final InetAddress long2InetAddress(long val)
InetAddress.val - int representation of IPv4 addresspublic static final int inetAddress2Int(InetAddress addr)
InetAddress to 32 bits int.addr - IPv4 address objectNullPointerException - addr is null.IllegalArgumentException - the address is not IPv4 (Inet4Address).public static final long inetAddress2Long(InetAddress addr)
InetAddress to 32 bits int, packages into a 64
bits long.addr - IPv4 address objectNullPointerException - addr is null.IllegalArgumentException - the address is not IPv4 (Inet4Address).public static void appendHostAddress(StringBuilder sbuf, InetAddress addr)
getHostAddress(java.net.InetAddress) when the address is not
the only piece of information put in the string.sbuf - the string builderaddr - the Internet addresspublic static String getHostAddress(InetAddress addr)
InetAddress.getHostAddress().addr - addressCopyright © 2018 Philip Helger. All rights reserved.