Android
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)
Returns the network interface which has the specified internet address bound to it, if one exists.
      static    NetworkInterface  getByName(String interfaceName)
Returns the network interface with the specified name, if one exists
          String  getDisplayName()
Returns the user readable name associated with the network interface
          Enumeration<InetAddress getInetAddresses()
Returns the list of internet addresses bound to the interface
          String  getName()
Returns the name associated with the network interface
      static    Enumeration<NetworkInterface getNetworkInterfaces()
Returns the list of network interfaces supported by the system or null if no interfaces are supported by the system
          int  hashCode()
Returns a hash code for this NetworkInterface object.
          String  toString()
Returns 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)

Returns 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)

Returns 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()

Returns 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<InetAddress> getInetAddresses()

Returns the list of internet addresses bound to the interface

Returns

  • list of internet addresses bound to the interface

public String getName()

Returns the name associated with the network interface

Returns

  • name associated with the network interface

public static Enumeration<NetworkInterface> getNetworkInterfaces()

Returns 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()

Returns 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()

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

Returns

  • a printable representation for the network interface
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48