public class NetUtils extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
ANYHOST
The Constant ANYHOST.
|
static String |
LOCALHOST
The Constant LOCALHOST.
|
| 构造器和说明 |
|---|
NetUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
getAvailablePort()
Gets the available port.
|
static int |
getAvailablePort(int port)
Gets the available port.
|
static InetAddress |
getLocalAddress()
Gets the local address.
|
static InetSocketAddress |
getLocalSocketAddress(String host,
int port)
Gets the local socket address.
|
static String |
getLogHost()
Gets the log host.
|
static int |
getRandomPort()
Gets the random port.
|
static boolean |
isAnyHost(String host)
Checks if is any host.
|
static boolean |
isInvalidLocalHost(String host)
Checks if is invalid local host.
|
static boolean |
isInvalidPort(int port)
Checks if is invalid port.
|
static boolean |
isLocalHost(String host)
Checks if is local host.
|
static boolean |
isValidAddress(String address)
Checks if is valid address.
|
static boolean |
isValidLocalHost(String host)
Checks if is valid local host.
|
public static int getRandomPort()
public static int getAvailablePort()
public static int getAvailablePort(int port)
port - the portpublic static boolean isInvalidPort(int port)
port - the portpublic static boolean isValidAddress(String address)
address - the addresspublic static boolean isLocalHost(String host)
host - the hostpublic static boolean isAnyHost(String host)
host - the hostpublic static boolean isInvalidLocalHost(String host)
host - the hostpublic static boolean isValidLocalHost(String host)
host - the hostpublic static InetSocketAddress getLocalSocketAddress(String host, int port)
host - the hostport - the portpublic static InetAddress getLocalAddress()
public static String getLogHost()
Copyright © 2019 Baidu, Inc.. All rights reserved.