aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/InetAddress.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/net/InetAddress.java')
-rw-r--r--libjava/java/net/InetAddress.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java
index fcdd88c..970627e 100644
--- a/libjava/java/net/InetAddress.java
+++ b/libjava/java/net/InetAddress.java
@@ -230,7 +230,6 @@ public class InetAddress implements Serializable
* address is in getAddress()[0].
*
* @exception UnknownHostException If IP address has illegal length
- * be found
*
* @since 1.4
*/
@@ -243,6 +242,23 @@ public class InetAddress implements Serializable
return new InetAddress (addr, "");
}
+ /**
+ * Create an InetAddress based on the provided host name and IP address.
+ * No name service is checked for the validity of the address.
+ *
+ * @exception UnknownHostException If IP address is of illegal length
+ *
+ * @since 1.4
+ */
+ public static InetAddress getByAddress (String host, byte[] addr)
+ throws UnknownHostException
+ {
+ if (addr.length == 4 || addr.length == 16)
+ return new InetAddress (addr, host);
+
+ throw new UnknownHostException ("IP address has illegal length");
+ }
+
/** If host is a valid numeric IP address, return the numeric address.
* Otherwise, return null. */
private static native byte[] aton (String host);