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.

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.

"ThreadSafe"
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
    The value byte array of service property, when information is not available.
    static final String
    The value string of service property, when information is not available.
    static final String[]
    The value string array of service property, when information is not available.
    static final String
    The string of network interface type which means the network interface to connect to a local area network.
    static final String
    The key string of "networkAdapter.displayName" service property.
    static final String
    The key string of "networkAdapter.hardwareAddress" service property.
    static final String
    The key string of "networkAdapter.isLoopback" service property.
    static final String
    The key string of "networkAdapter.isPointToPoint" service property.
    static final String
    The key string of "networkAdapter.isUp" service property.
    static final String
    The key string of "networkAdapter.isVirtual" service property.
    static final String
    The key string of "networkAdapter.name" service property.
    static final String
    The key string of "networkAdapter.parent" service property.
    static final String
    The key string of "networkAdapter.subInterface" service property.
    static final String
    The key string of "networkAdapter.supportsMulticast" service property.
    static final String
    The key string of "networkAdapter.type" service property.
    static final String
    The string of network interface type which means the network interface to connect to an external network (i.e.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the network interface display name of "networkAdapter.displayname" service property value.
    byte[]
    Returns the MAC address of "networkAdapter.hardwareAddress" service property value.
    int
    Returns the Maximum Transmission Unit (MTU) of this interface.
    Returns the network interface name of "networkAdapter.name" service property value.
    Returns the network interface type of "networkAdapter.type" service property value.
    boolean
    Returns whether a network interface is a loopback interface.
    boolean
    Returns whether a network interface is a point to point interface.
    boolean
    Returns whether a network interface is up and running.
    boolean
    Returns whether this interface is a virtual interface (also called subinterface).
    boolean
    Returns whether a network interface supports multicasting or not.
  • Field Details

    • EMPTY_STRING

      static final String EMPTY_STRING
      The value string of service property, when information is not available.
      See Also:
    • 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 String[] EMPTY_STRING_ARRAY
      The value string array of service property, when information is not available.
    • NETWORKADAPTER_TYPE

      static final String NETWORKADAPTER_TYPE
      The key string of "networkAdapter.type" service property.

      Network Interface Type is specified.

      See Also:
    • NETWORKADAPTER_DISPLAYNAME

      static final 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:
    • NETWORKADAPTER_NAME

      static final 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:
    • NETWORKADAPTER_HARDWAREADDRESS

      static final 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:
    • NETWORKADAPTER_IS_UP

      static final 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:
    • NETWORKADAPTER_IS_LOOPBACK

      static final 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:
    • NETWORKADAPTER_IS_POINTTOPOINT

      static final 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:
    • NETWORKADAPTER_IS_VIRTUAL

      static final 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:
    • NETWORKADAPTER_SUPPORTS_MULTICAST

      static final 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:
    • NETWORKADAPTER_PARENT

      static final 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:
    • NETWORKADAPTER_SUBINTERFACE

      static final 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:
    • WAN

      static final String WAN
      The string of network interface type which means the network interface to connect to an external network (i.e. Internet).
      See Also:
    • LAN

      static final String LAN
      The string of network interface type which means the network interface to connect to a local area network.
      See Also:
  • Method Details

    • getNetworkAdapterType

      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

      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

      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 SocketException
      Returns the Maximum Transmission Unit (MTU) of this interface.
      Returns:
      The value of the MTU for that interface.
      Throws:
      SocketException - If an I/O error occurs.
    • isLoopback

      boolean isLoopback() throws SocketException
      Returns whether a network interface is a loopback interface.
      Returns:
      true if the interface is a loopback interface.
      Throws:
      SocketException - If an I/O error occurs.
    • isPointToPoint

      boolean isPointToPoint() throws SocketException
      Returns whether a network interface is a point to point interface.
      Returns:
      true if the interface is a point to point interface.
      Throws:
      SocketException - If an I/O error occurs.
    • isUp

      boolean isUp() throws SocketException
      Returns whether a network interface is up and running.
      Returns:
      true if the interface is up and running.
      Throws:
      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 SocketException
      Returns whether a network interface supports multicasting or not.
      Returns:
      true if the interface supports Multicasting.
      Throws:
      SocketException - If an I/O error occurs.