Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class NetworkInterface  view NetworkInterface download NetworkInterface.java

java.lang.Object
  extended byjava.net.NetworkInterface

public final class NetworkInterface
extends java.lang.Object

This class models a network interface on the host computer. A network interface contains a name (typically associated with a specific hardware adapter) and a list of addresses that are bound to it. For example, an ethernet interface may be named "eth0" and have the address 192.168.1.101 assigned to it.

Since:
1.4

Field Summary
private  java.util.Vector inetAddresses
           
private  java.lang.String name
           
 
Constructor Summary
(package private) NetworkInterface(java.lang.String name, InetAddress address)
           
(package private) NetworkInterface(java.lang.String name, InetAddress[] addresses)
           
 
Method Summary
private static java.util.Collection condense(java.util.Collection interfaces)
           
 boolean equals(java.lang.Object obj)
          Checks if the current instance is equal to obj
static NetworkInterface getByInetAddress(InetAddress addr)
          Return a network interface by its address
static NetworkInterface getByName(java.lang.String name)
          Returns an network interface by name
 java.lang.String getDisplayName()
          Returns the display name of the interface
 java.util.Enumeration getInetAddresses()
          Returns all available addresses of the network interface If a @see SecurityManager is available all addresses are checked with @see SecurityManager::checkConnect() if they are available.
 java.lang.String getName()
          Returns the name of the network interface
static java.util.Enumeration getNetworkInterfaces()
          Return an Enumeration of all available network interfaces
 int hashCode()
          Returns the hashcode of the current instance
 java.lang.String toString()
          Returns a string representation of the interface
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

inetAddresses

private java.util.Vector inetAddresses
Constructor Detail

NetworkInterface

NetworkInterface(java.lang.String name,
                 InetAddress address)

NetworkInterface

NetworkInterface(java.lang.String name,
                 InetAddress[] addresses)
Method Detail

getName

public java.lang.String getName()
Returns the name of the network interface


getInetAddresses

public java.util.Enumeration getInetAddresses()
Returns all available addresses of the network interface If a @see SecurityManager is available all addresses are checked with @see SecurityManager::checkConnect() if they are available. Only InetAddresses are returned where the security manager doesn't throw an exception.


getDisplayName

public java.lang.String getDisplayName()
Returns the display name of the interface


getByName

public static NetworkInterface getByName(java.lang.String name)
                                  throws SocketException
Returns an network interface by name


getByInetAddress

public static NetworkInterface getByInetAddress(InetAddress addr)
                                         throws SocketException
Return a network interface by its address


condense

private static java.util.Collection condense(java.util.Collection interfaces)

getNetworkInterfaces

public static java.util.Enumeration getNetworkInterfaces()
                                                  throws SocketException
Return an Enumeration of all available network interfaces


equals

public boolean equals(java.lang.Object obj)
Checks if the current instance is equal to obj


hashCode

public int hashCode()
Returns the hashcode of the current instance


toString

public java.lang.String toString()
Returns a string representation of the interface