summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--java/net/Inet6Address.java32
2 files changed, 37 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9844414cd..eecf9cff2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-07-19 Sven de Marothy <sven@physto.se>
+
+ * java/net/Inet6Address.java:
+ (getScopedId, getScopedInterface): New methods.
+
2006-07-19 Lillian Angel <langel@redhat.com>
* examples/gnu/classpath/examples/awt/Demo.java
diff --git a/java/net/Inet6Address.java b/java/net/Inet6Address.java
index 6f41b792b..8d834a6fd 100644
--- a/java/net/Inet6Address.java
+++ b/java/net/Inet6Address.java
@@ -242,6 +242,7 @@ public final class Inet6Address extends InetAddress
* Creates a scoped Inet6Address where the scope has an integer id.
*
* @throws UnkownHostException if the address is an invalid number of bytes.
+ * @since 1.5
*/
public static Inet6Address getByAddress(String host, byte[] addr,
int scopeId)
@@ -261,6 +262,7 @@ public final class Inet6Address extends InetAddress
* NetworkInterface.
*
* @throws UnkownHostException if the address is an invalid number of bytes.
+ * @since 1.5
*/
public static Inet6Address getByAddress(String host, byte[] addr,
NetworkInterface nif)
@@ -276,6 +278,36 @@ public final class Inet6Address extends InetAddress
}
/**
+ * Returns the <code>NetworkInterface</code> of the address scope
+ * if it is a scoped address and the scope is given in the form of a
+ * NetworkInterface.
+ * (I.e. the address was created using the
+ * getByAddress(String, byte[], NetworkInterface) method)
+ * Otherwise this method returns <code>null</code>.
+ * @since 1.5
+ */
+ public NetworkInterface getScopedInterface()
+ {
+ return nif;
+ }
+
+ /**
+ * Returns the scope ID of the address scope if it is a scoped adress using
+ * an integer to identify the scope.
+ *
+ * Otherwise this method returns 0.
+ * @since 1.5
+ */
+ public int getScopeId()
+ {
+ // check scope_id_set because some JDK-serialized objects seem to have
+ // scope_id set to a nonzero value even when scope_id_set == false
+ if( scope_id_set )
+ return scope_id;
+ return 0;
+ }
+
+ /**
* Returns the IP address string in textual presentation
*/
public String getHostAddress()