public abstract class HardWareUtils extends Object
| Constructor and Description |
|---|
HardWareUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
getHardwareAddress(InetAddress inetAddress)
获得指定地址信息中的硬件地址
|
static InetAddress |
getLocalhost()
获取本机网卡IP地址,规则如下:
|
static int |
getPid() |
static LinkedHashSet<InetAddress> |
localAddressList(Function<InetAddress,Boolean> addressFilter)
获取所有满足过滤条件的本地IP地址对象
|
public static LinkedHashSet<InetAddress> localAddressList(Function<InetAddress,Boolean> addressFilter)
addressFilter - 过滤器,null表示不过滤,获取所有地址public static InetAddress getLocalhost()
1. 查找所有网卡地址,必须非回路(loopback)地址、非局域网地址(siteLocal)、IPv4地址
2. 如果无满足要求的地址,调用 InetAddress.getLocalHost() 获取地址
此方法不会抛出异常,获取失败将返回null
见:https://github.com/dromara/hutool/issues/428
nullpublic static byte[] getHardwareAddress(InetAddress inetAddress)
inetAddress - InetAddresspublic static int getPid()
throws ObjectException
ObjectExceptionCopyright © 2024 江苏南大先腾信息产业股份有限公司. All rights reserved.