diff options
Diffstat (limited to 'libjava/classpath/java/net/NetworkInterface.java')
-rw-r--r-- | libjava/classpath/java/net/NetworkInterface.java | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/libjava/classpath/java/net/NetworkInterface.java b/libjava/classpath/java/net/NetworkInterface.java index a3a6058afa1..5ec64ff16ce 100644 --- a/libjava/classpath/java/net/NetworkInterface.java +++ b/libjava/classpath/java/net/NetworkInterface.java @@ -1,5 +1,5 @@ /* NetworkInterface.java -- - Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,6 +40,8 @@ package java.net; import gnu.classpath.SystemProperties; +import gnu.java.lang.CPStringBuilder; + import java.util.Enumeration; import java.util.Iterator; import java.util.Vector; @@ -247,10 +249,10 @@ public final class NetworkInterface public String toString() { // FIXME: check if this is correct - StringBuffer result; + CPStringBuilder result; String separator = SystemProperties.getProperty("line.separator"); - result = new StringBuffer(); + result = new CPStringBuilder(); result.append("name: "); result.append(getDisplayName()); @@ -265,4 +267,50 @@ public final class NetworkInterface return result.toString(); } + + /** + * Determines whether this interface is ready to transfer data. + * + * @return whether the interface is up + */ + public boolean isUp() + throws SocketException + { + return VMNetworkInterface.isUp(netif.name); + } + + /** + * Determines whether this interface does point to point + * transmission. + * + * @return whether the interface does point to point transmission + */ + public boolean isPointToPoint() + throws SocketException + { + return VMNetworkInterface.isPointToPoint(netif.name); + } + + /** + * Determines whether this interface is the loopback interface. + * + * @return whether the interface is the loopback interface + */ + public boolean isLoopback() + throws SocketException + { + return VMNetworkInterface.isLoopback(netif.name); + } + + /** + * Determines whether this interface supports multicast transmission. + * + * @return whether the interface supports multicast transmission. + */ + public boolean supportsMulticast() + throws SocketException + { + return VMNetworkInterface.supportsMulticast(netif.name); + } + } |