public class Nets extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
PORT_RANGE_MAX
默认最大端口,65535
|
static int |
PORT_RANGE_MIN
默认最小端口,1024
|
| 构造器和说明 |
|---|
Nets() |
| 限定符和类型 | 方法和说明 |
|---|---|
static InetSocketAddress |
createAddress(String host,
int port) |
static byte[] |
downloadBytes(String url) |
static void |
downloadFile(String url,
File file) |
static String |
downloadString(String url) |
static String |
downloadString(String url,
String encoding) |
static String |
getLocalMacAddress() |
static String |
getMacAddress(InetAddress inetAddress) |
static String |
getMacAddress(InetAddress inetAddress,
String separator) |
static int |
getRandomLocalPort() |
static int |
getRandomLocalPort(int minPort,
int maxPort) |
static long |
getRemoteFileSize(String url) |
static int |
getUsableLocalPort() |
static int |
getUsableLocalPort(int minPort) |
static int |
getUsableLocalPort(int minPort,
int maxPort) |
static boolean |
isIPv4Address(String input) |
static boolean |
isIPv4MappedIPv64Address(String input) |
static boolean |
isIPv6Address(String input) |
static boolean |
isIPv6HexCompressedAddress(String input) |
static boolean |
isIPv6StdAddress(String input) |
static boolean |
isUsableLocalPort(int port) |
static boolean |
isValidPort(int port) |
static String |
send(String host,
int port,
String content) |
public static final int PORT_RANGE_MIN
public static final int PORT_RANGE_MAX
public static boolean isValidPort(int port)
public static boolean isUsableLocalPort(int port)
public static int getUsableLocalPort()
public static int getUsableLocalPort(int minPort)
public static int getUsableLocalPort(int minPort,
int maxPort)
public static int getRandomLocalPort()
public static int getRandomLocalPort(int minPort,
int maxPort)
public static String getLocalMacAddress() throws UnknownHostException
public static String getMacAddress(InetAddress inetAddress)
public static String getMacAddress(InetAddress inetAddress, String separator)
public static InetSocketAddress createAddress(String host, int port)
public static String send(String host, int port, String content) throws IOException
IOExceptionpublic static byte[] downloadBytes(String url) throws IOException
IOExceptionpublic static String downloadString(String url, String encoding) throws IOException
IOExceptionpublic static String downloadString(String url) throws IOException
IOExceptionpublic static void downloadFile(String url, File file) throws IOException
IOExceptionpublic static long getRemoteFileSize(String url) throws IOException
IOExceptionpublic static boolean isIPv4Address(String input)
public static boolean isIPv4MappedIPv64Address(String input)
public static boolean isIPv6StdAddress(String input)
public static boolean isIPv6HexCompressedAddress(String input)
public static boolean isIPv6Address(String input)
Copyright © 2025 fossc. All rights reserved.