public class IPHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
ensurePortOrDefault(String address,
int port)
Checks if the address string contains a port.
|
static String |
extractIP(String s) |
static InetAddress |
getByAddress(int[] ints)
Convenience function that creates an IP address from a int[] instead of a byte[]
|
static boolean |
isLocalhost(String hostName) |
static byte[] |
lookupLocalhost(String hostName) |
static byte[] |
toByteArray(String s) |
static InetAddress |
toInetAddress(String s) |
static InetSocketAddress |
toInetSocketAddress(String s) |
static int |
toPort(String s) |
public static boolean isLocalhost(String hostName)
public static byte[] lookupLocalhost(String hostName)
public static byte[] toByteArray(String s)
public static int toPort(String s)
public static InetAddress toInetAddress(String s) throws UnknownHostException
UnknownHostExceptionpublic static InetSocketAddress toInetSocketAddress(String s)
public static String ensurePortOrDefault(String address, int port)
address - Address string with or without portport - default portpublic static InetAddress getByAddress(int[] ints)
ints - Address bytes.Copyright © 2024. All rights reserved.