diff options
author | Sven de Marothy <sven@physto.se> | 2006-07-19 16:21:20 +0000 |
---|---|---|
committer | Sven de Marothy <sven@physto.se> | 2006-07-19 16:21:20 +0000 |
commit | e339c07d0b6cbb00a0fc600e592a8e288250e772 (patch) | |
tree | bf9ecae9f489ca46e8dea1a0d4d61988901b53cc /java | |
parent | 43a4128ea516c8a978ddc2050df5a8cda7dc1a39 (diff) | |
download | classpath-libgcj-import-20060719.tar.gz |
2006-07-19 Sven de Marothy <sven@physto.se>libgcj-import-20060719
* java/net/Inet6Address.java:
(getScopedId, getScopedInterface): New methods.
Diffstat (limited to 'java')
-rw-r--r-- | java/net/Inet6Address.java | 32 |
1 files changed, 32 insertions, 0 deletions
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() |