/[classpath]/classpath/java/net/NetworkInterface.java
ViewVC logotype

Diff of /classpath/java/net/NetworkInterface.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8.2.3 by gnu_andrew, Sat Feb 19 10:50:38 2005 UTC revision 1.8.2.4 by gnu_andrew, Mon Apr 18 01:37:38 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package java.net;  package java.net;
40    
 import gnu.classpath.Configuration;  
   
41  import java.util.Enumeration;  import java.util.Enumeration;
42  import java.util.Vector;  import java.util.Vector;
43    
# Line 55  import java.util.Vector; Line 53  import java.util.Vector;
53   */   */
54  public final class NetworkInterface  public final class NetworkInterface
55  {  {
   static  
     {  
       if (Configuration.INIT_LOAD_LIBRARY)  
         System.loadLibrary("javanet");  
     }  
   
56    private String name;    private String name;
57    private Vector inetAddresses;    private Vector inetAddresses;
58    
59    private NetworkInterface(String name, InetAddress address)    NetworkInterface(String name, InetAddress address)
60    {    {
61      this.name = name;      this.name = name;
62      this.inetAddresses = new Vector(1, 1);      this.inetAddresses = new Vector(1, 1);
63      this.inetAddresses.add(address);      this.inetAddresses.add(address);
64    }    }
65    
66    private static native Vector getRealNetworkInterfaces()    NetworkInterface(String name, InetAddress[] addresses)
67      throws SocketException;    {
68        this.name = name;
69        this.inetAddresses = new Vector(addresses.length, 1);
70    
71        for (int i = 0; i < addresses.length; i++)
72          this.inetAddresses.add(addresses[i]);
73      }
74    
75    /**    /**
76     * Returns the name of the network interface     * Returns the name of the network interface
# Line 145  public final class NetworkInterface Line 143  public final class NetworkInterface
143    public static NetworkInterface getByName(String name)    public static NetworkInterface getByName(String name)
144      throws SocketException      throws SocketException
145    {    {
146      Vector networkInterfaces = getRealNetworkInterfaces();      Vector networkInterfaces = VMNetworkInterface.getInterfaces();
147    
148      for (Enumeration e = networkInterfaces.elements(); e.hasMoreElements();)      for (Enumeration e = networkInterfaces.elements(); e.hasMoreElements();)
149        {        {
# Line 172  public final class NetworkInterface Line 170  public final class NetworkInterface
170    public static NetworkInterface getByInetAddress(InetAddress addr)    public static NetworkInterface getByInetAddress(InetAddress addr)
171      throws SocketException      throws SocketException
172    {    {
173      Vector networkInterfaces = getRealNetworkInterfaces();      Vector networkInterfaces = VMNetworkInterface.getInterfaces();
174    
175      for (Enumeration interfaces = networkInterfaces.elements();      for (Enumeration interfaces = networkInterfaces.elements();
176           interfaces.hasMoreElements();)           interfaces.hasMoreElements();)
# Line 199  public final class NetworkInterface Line 197  public final class NetworkInterface
197     */     */
198    public static Enumeration getNetworkInterfaces() throws SocketException    public static Enumeration getNetworkInterfaces() throws SocketException
199    {    {
200      Vector networkInterfaces = getRealNetworkInterfaces();      Vector networkInterfaces = VMNetworkInterface.getInterfaces();
201    
202      if (networkInterfaces.isEmpty())      if (networkInterfaces.isEmpty())
203        return null;        return null;

Legend:
Removed from v.1.8.2.3  
changed lines
  Added in v.1.8.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26