public class INetUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
LOCAL_HOST |
| Constructor and Description |
|---|
INetUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
getHostIp()
获取 服务器 HostIp
|
static String |
getHostName()
获取 服务器 hostname
|
static InetAddress |
getInetAddress(String ip)
将 ip 转成 InetAddress
|
static boolean |
isInternalIp(byte[] addr)
判断是否内网 ip
|
static boolean |
isInternalIp(InetAddress address)
判断是否内网 ip
|
static boolean |
isInternalIp(String ip)
判断是否内网 ip
|
static boolean |
isLocalIp(InetAddress address)
判断是否本地 ip
|
static boolean |
tryPort(int port)
尝试端口时候被占用
|
public static final String LOCAL_HOST
public static String getHostName()
public static String getHostIp()
public static boolean tryPort(int port)
port - 端口号public static InetAddress getInetAddress(String ip)
ip - ippublic static boolean isInternalIp(String ip)
ip - ippublic static boolean isInternalIp(InetAddress address)
address - InetAddresspublic static boolean isLocalIp(InetAddress address)
address - InetAddresspublic static boolean isInternalIp(byte[] addr)
addr - ipCopyright © 2024. All rights reserved.