From f5b63cb6d7bb6b742d69f428cc80d60a93f45b3a Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Sat, 5 Oct 2002 07:49:08 +0000 Subject: 2002-10-05 Michael Koch * java/net/InetAddress.java (getByAddress): Fixed documentation. (getByAddress): New method. * java/net/Inet4Address.java: New file. * java/net/URL.java (URL): Documentation added. (getContent): Documentation added. (getContent): New stubbed method. (getQuery): New method. (openConnection): Documentation added. (openStream): Documentation added. (setURLStreamHandlerFactory): Documentation added. * java/net/URI.java: New stub file. * Makefile.am (java_native_source_files): Added java/net/Inet4Address.java, java/net/Inet6Address.java and java/net/URI.java. * Makefile.in: Regenerated. From-SVN: r57841 --- libjava/java/net/InetAddress.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'libjava/java/net/InetAddress.java') 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); -- cgit v1.1