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 boolean
updateNetworkStats(NetworkIF netIF)
Updates interface network statistics on the given interface.
-
Constructor Details
-
MacNetworks
public MacNetworks()
-
-
Method Details
-
getNetworks
Description copied from class:Networks
Gets the network interfaces on this machine- Overrides:
getNetworks
in classNetworks
- Returns:
- An array of
NetworkIF
objects 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.IFdata
object indexed by the interface index, encapsulating the stats, ornull
if 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:
true
if the update was successful,false
otherwise.
-