English | Site Directory

Android - An Open Handset Alliance Project

java.net
public final class

java.net.NetworkInterface

java.lang.Object
java.net.NetworkInterface

This class provides an methods that are used to get information about the network interfaces supported by the system

Summary

Public Methods

        boolean  equals(Object obj)
Compares the specified object to this NetworkInterface and answer if they are equal.
      static  NetworkInterface  getByInetAddress(InetAddress address)
Answers the network interface which has the specified internet address bound to it, if one exists.
      static  NetworkInterface  getByName(String interfaceName)
Answers the network interface with the specified name, if one exists
        String  getDisplayName()
Answers the user readable name associated with the network interface
        Enumeration  getInetAddresses()
Answers the list of internet addresses bound to the interface
        String  getName()
Answers the name associated with the network interface
      static  Enumeration  getNetworkInterfaces()
Answers the list of network interfaces supported by the system or null if no interfaces are supported by the system
        int  hashCode()
Answers a hash code for this NetworkInterface object.
        String  toString()
Answers a string containing a concise, human-readable description of the network interface
Methods inherited from class java.lang.Object

Details

Public Methods

public boolean equals(Object obj)

Compares the specified object to this NetworkInterface and answer if they are equal. The object must be an instance of NetworkInterface with the same name, displayName and list of network interfaces to be the same

Parameters

obj the object to compare

Returns

  • true if the specified object is equal to this NetworkInterfcae, false otherwise

See Also

public static NetworkInterface getByInetAddress(InetAddress address)

Answers the network interface which has the specified internet address bound to it, if one exists.

Parameters

address address of interest

Returns

  • network interface for internet address specified if it exists, otherwise null

Throws

SocketException if an error occurs when getting network interface information
NullPointerException if the address passed in is null

public static NetworkInterface getByName(String interfaceName)

Answers the network interface with the specified name, if one exists

Returns

  • network interface for name specified if it exists, otherwise null

Throws

SocketException if an error occurs when getting network interface information
NullPointerException if the interface name passed in is null

public String getDisplayName()

Answers the user readable name associated with the network interface

Returns

  • display name associated with the network interface or null if one is not available

public Enumeration getInetAddresses()

Answers the list of internet addresses bound to the interface

Returns

  • list of internet addresses bound to the interface

public String getName()

Answers the name associated with the network interface

Returns

  • name associated with the network interface

public static Enumeration getNetworkInterfaces()

Answers the list of network interfaces supported by the system or null if no interfaces are supported by the system

Returns

  • Enumeration containing one NetworkInterface object for each interface supported by the system

Throws

SocketException if an error occurs when getting network interface information

public int hashCode()

Answers a hash code for this NetworkInterface object. Since the name should be unique for each network interface the hash code is generated using this name

Returns

  • the hashcode for hashtable indexing

public String toString()

Answers a string containing a concise, human-readable description of the network interface

Returns

  • a printable representation for the network interface
Build m5-rc15i - 10 Jun 2008 13:54