public final class MacCache extends Object
String ipAddress = ?;
String macAddress = MacCache.get(ipAddress);
if(macAddress != null)
{
System.out.println("Found MAC: " + macAddress);
}
else
{
System.out.println("Cannot find MAC address for the provided address.");
}
| Modifier and Type | Method and Description |
|---|---|
static String |
get(String localAddress)
Return the MAC address of a currently native-cached local address.
|
static MacCache |
getInstance() |
String |
getMacFromAddress(String localAddress)
Return the MAC address of a currently native-cached local address.
|
public static MacCache getInstance()
public String getMacFromAddress(String localAddress) throws UnsupportedOperatingSystemException
The returned MAC address, if not null, will always return leading-zeroed for each group of two (2) hexadecimal digits with the separator always being a dash (-). For example: ff-00-ff-00-ff-00
This method is non-blocking.
localAddress - The address.UnsupportedOperatingSystemException - Thrown if the current
operating system is not supported.public static String get(String localAddress)
The returned MAC address, if not null, will always return leading-zeroed for each group of two (2) hexadecimal digits with the separator always being a dash (-). For example: ff-00-ff-00-ff-00
This method is non-blocking.
localAddress - The address.Copyright © 2016. All Rights Reserved.