diff options
author | Michael Koch <konqueror@gmx.de> | 2002-10-05 07:49:08 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2002-10-05 07:49:08 +0000 |
commit | f5b63cb6d7bb6b742d69f428cc80d60a93f45b3a (patch) | |
tree | c89d38b0940a603cf77e3e41a1c3da5ff31cd85c /libjava/java/net/InetAddress.java | |
parent | fec836256eb5cd5a1e9e2a7d16f2a19797f9f0fb (diff) | |
download | gcc-f5b63cb6d7bb6b742d69f428cc80d60a93f45b3a.zip gcc-f5b63cb6d7bb6b742d69f428cc80d60a93f45b3a.tar.gz gcc-f5b63cb6d7bb6b742d69f428cc80d60a93f45b3a.tar.bz2 |
2002-10-05 Michael Koch <konqueror@gmx.de>
* 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
Diffstat (limited to 'libjava/java/net/InetAddress.java')
-rw-r--r-- | libjava/java/net/InetAddress.java | 18 |
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); |