Package oshi.hardware.platform.mac
Class MacNetworks
java.lang.Object
oshi.hardware.common.Networks
oshi.hardware.platform.mac.MacNetworks
@ThreadSafe public final class MacNetworks extends Networks
MacNetworks class.
-
Constructor Summary
Constructors Constructor Description MacNetworks() -
Method Summary
Modifier and Type Method Description NetworkIF[]getNetworks()Gets the network interfaces on this machinestatic java.util.Map<java.lang.Integer,oshi.hardware.platform.mac.MacNetworks.IFdata>queryIFdata(int index)Map all network interfaces.static booleanupdateNetworkStats(NetworkIF netIF)Updates interface network statistics on the given interface.
-
Constructor Details
-
MacNetworks
public MacNetworks()
-
-
Method Details
-
getNetworks
Description copied from class:NetworksGets the network interfaces on this machine- Overrides:
getNetworksin classNetworks- Returns:
- An array of
NetworkIFobjects representing the interfaces
-
queryIFdata
public static java.util.Map<java.lang.Integer,oshi.hardware.platform.mac.MacNetworks.IFdata> queryIFdata(int index)Map all network interfaces. Ported from source code of "netstat -ir". See http://opensource.apple.com/source/network_cmds/network_cmds-457/ netstat.tproj/if.c- Parameters:
index- If nonnegative, returns results for only that index- Returns:
- a map of
MacNetworks.IFdataobject indexed by the interface index, encapsulating the stats, ornullif the query failed.
-
updateNetworkStats
Updates interface network statistics on the given interface. Statistics include packets and bytes sent and received, and interface speed.- Parameters:
netIF- The interface on which to update statistics- Returns:
trueif the update was successful,falseotherwise.
-