diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-05 07:49:08 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-10-05 07:49:08 +0000 |
commit | c8e1e283bfe6457139acfce9bcf90c27e6e84dd6 (patch) | |
tree | c89d38b0940a603cf77e3e41a1c3da5ff31cd85c /libjava/java/net/InetAddress.java | |
parent | ef3df728cc66889ca6ba594e7580351fdfdc5422 (diff) | |
download | ppe42-gcc-c8e1e283bfe6457139acfce9bcf90c27e6e84dd6.tar.gz ppe42-gcc-c8e1e283bfe6457139acfce9bcf90c27e6e84dd6.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57841 138bc75d-0d04-0410-961f-82ee72b054a4
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 fcdd88cff78..970627e0f08 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); |