Class AbstractNetworkIF
- All Implemented Interfaces:
NetworkIF
- Direct Known Subclasses:
AixNetworkIF,BsdNetworkIF,LinuxNetworkIF,MacNetworkIF,SolarisNetworkIF,WindowsNetworkIF
-
Nested Class Summary
Nested classes/interfaces inherited from interface oshi.hardware.NetworkIF
NetworkIF.IfOperStatus -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractNetworkIF(NetworkInterface netint) Construct aNetworkIFobject backed by the specifiedNetworkInterface.protectedAbstractNetworkIF(NetworkInterface netint, String displayName) Construct aNetworkIFobject backed by the specifiedNetworkInterface. -
Method Summary
Modifier and TypeMethodDescriptionInterface description.intgetIndex()Interface index.String[]The Internet Protocol (IP) v4 address.String[]The Internet Protocol (IP) v6 address.The Media Access Control (MAC) address.longgetMTU()The interface Maximum Transmission Unit (MTU).getName()Interface name.protected static List<NetworkInterface> getNetworkInterfaces(boolean includeLocalInterfaces) Returns network interfaces on this machine.Short[]The Internet Protocol (IP) v6 address.Short[]The Internet Protocol (IP) v4 subnet masks.booleanDetermines if the MAC address on this interface corresponds to a known Virtual Machine.Gets theNetworkInterfaceobject.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface oshi.hardware.NetworkIF
getBytesRecv, getBytesSent, getCollisions, getIfAlias, getIfOperStatus, getIfType, getInDrops, getInErrors, getNdisPhysicalMediumType, getOutErrors, getPacketsRecv, getPacketsSent, getSpeed, getTimeStamp, isConnectorPresent, updateAttributes
-
Constructor Details
-
AbstractNetworkIF
Construct aNetworkIFobject backed by the specifiedNetworkInterface.- Parameters:
netint- The core javaNetworkInterfacebacking this object.- Throws:
InstantiationException- If a socket exception prevents access to the backing interface.
-
AbstractNetworkIF
protected AbstractNetworkIF(NetworkInterface netint, String displayName) throws InstantiationException Construct aNetworkIFobject backed by the specifiedNetworkInterface.- Parameters:
netint- The core javaNetworkInterfacebacking this object.displayName- A string to use for the display name in preference to theNetworkInterfacevalue.- Throws:
InstantiationException- If a socket exception prevents access to the backing interface.
-
-
Method Details
-
getNetworkInterfaces
Returns network interfaces on this machine.- Parameters:
includeLocalInterfaces- include local interfaces in the result- Returns:
- A list of network interfaces
-
queryNetworkInterface
Description copied from interface:NetworkIFGets theNetworkInterfaceobject.- Specified by:
queryNetworkInterfacein interfaceNetworkIF- Returns:
- the network interface, an instance of
NetworkInterface.
-
getName
Description copied from interface:NetworkIFInterface name. -
getIndex
public int getIndex()Description copied from interface:NetworkIFInterface index. -
getDisplayName
Description copied from interface:NetworkIFInterface description.- Specified by:
getDisplayNamein interfaceNetworkIF- Returns:
- The description of the network interface. On some platforms, this is identical to the name.
-
getMTU
public long getMTU()Description copied from interface:NetworkIFThe interface Maximum Transmission Unit (MTU).- Specified by:
getMTUin interfaceNetworkIF- Returns:
- The MTU of the network interface.
The value is a 32-bit integer which may be unsigned on some operating systems. On Windows, some non-physical interfaces (e.g., loopback) may return a value of -1 which is equivalent to the maximum unsigned integer value.
This value is set when the
NetworkIFis instantiated and may not be up to date.
-
getMacaddr
Description copied from interface:NetworkIFThe Media Access Control (MAC) address.- Specified by:
getMacaddrin interfaceNetworkIF- Returns:
- The MAC Address.
This value is set when the
NetworkIFis instantiated and may not be up to date.
-
getIPv4addr
Description copied from interface:NetworkIFThe Internet Protocol (IP) v4 address.- Specified by:
getIPv4addrin interfaceNetworkIF- Returns:
- An array of IPv4 Addresses.
This value is set when the
NetworkIFis instantiated and may not be up to date.
-
getSubnetMasks
Description copied from interface:NetworkIFThe Internet Protocol (IP) v4 subnet masks.- Specified by:
getSubnetMasksin interfaceNetworkIF- Returns:
- An array of IPv4 subnet mask lengths, corresponding to the IPv4 addresses from
NetworkIF.getIPv4addr(). Ranges between 0-32.This value is set when the
NetworkIFis instantiated and may not be up to date.
-
getIPv6addr
Description copied from interface:NetworkIFThe Internet Protocol (IP) v6 address.- Specified by:
getIPv6addrin interfaceNetworkIF- Returns:
- An array of IPv6 Addresses.
This value is set when the
NetworkIFis instantiated and may not be up to date.
-
getPrefixLengths
Description copied from interface:NetworkIFThe Internet Protocol (IP) v6 address.- Specified by:
getPrefixLengthsin interfaceNetworkIF- Returns:
- The IPv6 address prefix lengths, corresponding to the IPv6 addresses from
NetworkIF.getIPv6addr(). Ranges between 0-128.This value is set when the
NetworkIFis instantiated and may not be up to date.
-
isKnownVmMacAddr
public boolean isKnownVmMacAddr()Description copied from interface:NetworkIFDetermines if the MAC address on this interface corresponds to a known Virtual Machine.- Specified by:
isKnownVmMacAddrin interfaceNetworkIF- Returns:
trueif the MAC address corresponds to a known virtual machine.
-
toString
-