Interface NetworkAdapter
-
public interface NetworkAdapter
NetworkAdapter is an interface that provides information about single network interfaces provided by the execution environment.If multiple network interfaces are present, NetworkAdapter Services that correspond to each network interface must be registered. Network interface information service is set the following information as service property.
NETWORKADAPTER_TYPE
: Network Interface TypeNETWORKADAPTER_DISPLAYNAME
: Network Interface Display NameNETWORKADAPTER_NAME
: Network Interface NameNETWORKADAPTER_HARDWAREADDRESS
: Hardware AddressNETWORKADAPTER_IS_UP
: Running status of Network InterfaceNETWORKADAPTER_IS_LOOPBACK
: To check loopback interfaceNETWORKADAPTER_IS_POINTTOPOINT
: To check point to point interfaceNETWORKADAPTER_IS_VIRTUAL
: To check virtual interfaceNETWORKADAPTER_SUPPORTS_MULTICAST
: To check supports multicastingNETWORKADAPTER_PARENT
: The PID of parent Network InterfaceNETWORKADAPTER_SUBINTERFACE
: The PID of sub Network Interface
When a network interface becomes available, NetworkAdapter service associated with the network interface is registered with the service registry. If the network interface becomes unavailable, the corresponding NetworkAdapter service is unregistered.
When the attribute values of the network interface are set to the service property changes, NetworkAdapter service is updated. NetworkAdapter interface provides a method corresponding to java.net.NetworkInterface in order to provide information on the associated network interface. However, this interface method does not support the Static method. In addition, because NetworkInterface object or InetAddress object is registered in the service registry as NetworkAdapter and NetworkAddress, the NetworkAdapter interface does not provide a method to get those objects. NetworkAdapter provides a method to retrieve the value of an attribute of a network interface.
- Author:
- $Id: 07c677445b11954d7cd3aa30a089c737b3ef1783 $
-
-
Field Summary
Fields Modifier and Type Field Description static byte[]
EMPTY_BYTE_ARRAY
The value byte array of service property, when information is not available.static java.lang.String
EMPTY_STRING
The value string of service property, when information is not available.static java.lang.String[]
EMPTY_STRING_ARRAY
The value string array of service property, when information is not available.static java.lang.String
LAN
The string of network interface type which means the network interface to connect to a local area network.static java.lang.String
NETWORKADAPTER_DISPLAYNAME
The key string of "networkAdapter.displayName" service property.static java.lang.String
NETWORKADAPTER_HARDWAREADDRESS
The key string of "networkAdapter.hardwareAddress" service property.static java.lang.String
NETWORKADAPTER_IS_LOOPBACK
The key string of "networkAdapter.isLoopback" service property.static java.lang.String
NETWORKADAPTER_IS_POINTTOPOINT
The key string of "networkAdapter.isPointToPoint" service property.static java.lang.String
NETWORKADAPTER_IS_UP
The key string of "networkAdapter.isUp" service property.static java.lang.String
NETWORKADAPTER_IS_VIRTUAL
The key string of "networkAdapter.isVirtual" service property.static java.lang.String
NETWORKADAPTER_NAME
The key string of "networkAdapter.name" service property.static java.lang.String
NETWORKADAPTER_PARENT
The key string of "networkAdapter.parent" service property.static java.lang.String
NETWORKADAPTER_SUBINTERFACE
The key string of "networkAdapter.subInterface" service property.static java.lang.String
NETWORKADAPTER_SUPPORTS_MULTICAST
The key string of "networkAdapter.supportsMulticast" service property.static java.lang.String
NETWORKADAPTER_TYPE
The key string of "networkAdapter.type" service property.static java.lang.String
WAN
The string of network interface type which means the network interface to connect to an external network (i.e.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getDisplayName()
Returns the network interface display name of "networkAdapter.displayname" service property value.byte[]
getHardwareAddress()
Returns the MAC address of "networkAdapter.hardwareAddress" service property value.int
getMTU()
Returns the Maximum Transmission Unit (MTU) of this interface.java.lang.String
getName()
Returns the network interface name of "networkAdapter.name" service property value.java.lang.String
getNetworkAdapterType()
Returns the network interface type of "networkAdapter.type" service property value.boolean
isLoopback()
Returns whether a network interface is a loopback interface.boolean
isPointToPoint()
Returns whether a network interface is a point to point interface.boolean
isUp()
Returns whether a network interface is up and running.boolean
isVirtual()
Returns whether this interface is a virtual interface (also called subinterface).boolean
supportsMulticast()
Returns whether a network interface supports multicasting or not.
-
-
-
Field Detail
-
EMPTY_STRING
static final java.lang.String EMPTY_STRING
The value string of service property, when information is not available.- See Also:
- Constant Field Values
-
EMPTY_BYTE_ARRAY
static final byte[] EMPTY_BYTE_ARRAY
The value byte array of service property, when information is not available.
-
EMPTY_STRING_ARRAY
static final java.lang.String[] EMPTY_STRING_ARRAY
The value string array of service property, when information is not available.
-
NETWORKADAPTER_TYPE
static final java.lang.String NETWORKADAPTER_TYPE
The key string of "networkAdapter.type" service property.Network Interface Type is specified.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_DISPLAYNAME
static final java.lang.String NETWORKADAPTER_DISPLAYNAME
The key string of "networkAdapter.displayName" service property.Network Interface display name is specified.
EMPTY_STRING
if no display name is available.- See Also:
- Constant Field Values
-
NETWORKADAPTER_NAME
static final java.lang.String NETWORKADAPTER_NAME
The key string of "networkAdapter.name" service property.Network Interface Name is specified.
EMPTY_STRING
if no name is available.- See Also:
- Constant Field Values
-
NETWORKADAPTER_HARDWAREADDRESS
static final java.lang.String NETWORKADAPTER_HARDWAREADDRESS
The key string of "networkAdapter.hardwareAddress" service property.Hardware Address is specified.
EMPTY_BYTE_ARRAY
if no hardware address is available.- See Also:
- Constant Field Values
-
NETWORKADAPTER_IS_UP
static final java.lang.String NETWORKADAPTER_IS_UP
The key string of "networkAdapter.isUp" service property.The value is true when a network interface is up and running, otherwise it is false.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_IS_LOOPBACK
static final java.lang.String NETWORKADAPTER_IS_LOOPBACK
The key string of "networkAdapter.isLoopback" service property.The value is true when a network interface is a loopback interface, otherwise it is false.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_IS_POINTTOPOINT
static final java.lang.String NETWORKADAPTER_IS_POINTTOPOINT
The key string of "networkAdapter.isPointToPoint" service property.The value is true when a network interface is a point to point interface, otherwise it is false.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_IS_VIRTUAL
static final java.lang.String NETWORKADAPTER_IS_VIRTUAL
The key string of "networkAdapter.isVirtual" service property.The value is true when a network interface is a virtual interface, otherwise it is false.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_SUPPORTS_MULTICAST
static final java.lang.String NETWORKADAPTER_SUPPORTS_MULTICAST
The key string of "networkAdapter.supportsMulticast" service property.The value is true when a network interface supports multicasting, otherwise it is false.
- See Also:
- Constant Field Values
-
NETWORKADAPTER_PARENT
static final java.lang.String NETWORKADAPTER_PARENT
The key string of "networkAdapter.parent" service property.Service PID of the NetworkAdapter service which is parent of this NetworkAdapter is specified.
EMPTY_STRING
if no parent is available.- See Also:
- Constant Field Values
-
NETWORKADAPTER_SUBINTERFACE
static final java.lang.String NETWORKADAPTER_SUBINTERFACE
The key string of "networkAdapter.subInterface" service property.Service PID of the NetworkAdapter service which is subinterface of this NetworkAdapter is specified.
EMPTY_STRING_ARRAY
if no subinterface is available.- See Also:
- Constant Field Values
-
WAN
static final java.lang.String WAN
The string of network interface type which means the network interface to connect to an external network (i.e. Internet).- See Also:
- Constant Field Values
-
LAN
static final java.lang.String LAN
The string of network interface type which means the network interface to connect to a local area network.- See Also:
- Constant Field Values
-
-
Method Detail
-
getNetworkAdapterType
java.lang.String getNetworkAdapterType()
Returns the network interface type of "networkAdapter.type" service property value.- Returns:
- Network Interface Type, or null if "networkAdapter.type" service property value is empty.
-
getDisplayName
java.lang.String getDisplayName()
Returns the network interface display name of "networkAdapter.displayname" service property value.- Returns:
- Network Interface display name, or null if "networkAdapter.displayname" service property value is empty.
-
getName
java.lang.String getName()
Returns the network interface name of "networkAdapter.name" service property value.- Returns:
- Network Interface Name, or null if "networkAdapter.name" service property value is empty.
-
getHardwareAddress
byte[] getHardwareAddress()
Returns the MAC address of "networkAdapter.hardwareAddress" service property value.- Returns:
- Hardware Address, or null if "networkAdapter.hardwareAddress" service property value is empty.
-
getMTU
int getMTU() throws java.net.SocketException
Returns the Maximum Transmission Unit (MTU) of this interface.- Returns:
- The value of the MTU for that interface.
- Throws:
java.net.SocketException
- If an I/O error occurs.
-
isLoopback
boolean isLoopback() throws java.net.SocketException
Returns whether a network interface is a loopback interface.- Returns:
- true if the interface is a loopback interface.
- Throws:
java.net.SocketException
- If an I/O error occurs.
-
isPointToPoint
boolean isPointToPoint() throws java.net.SocketException
Returns whether a network interface is a point to point interface.- Returns:
- true if the interface is a point to point interface.
- Throws:
java.net.SocketException
- If an I/O error occurs.
-
isUp
boolean isUp() throws java.net.SocketException
Returns whether a network interface is up and running.- Returns:
- true if the interface is up and running.
- Throws:
java.net.SocketException
- If an I/O error occurs.
-
isVirtual
boolean isVirtual()
Returns whether this interface is a virtual interface (also called subinterface). Virtual interfaces are, on some systems, interfaces created as a child of a physical interface and given different settings (like address or MTU). Usually the name of the interface will the name of the parent followed by a colon (:) and a number identifying the child since there can be several virtual interfaces attached to a single physical interface.- Returns:
- true if this interface is a virtual interface.
-
supportsMulticast
boolean supportsMulticast() throws java.net.SocketException
Returns whether a network interface supports multicasting or not.- Returns:
- true if the interface supports Multicasting.
- Throws:
java.net.SocketException
- If an I/O error occurs.
-
-