From cc40c1e13044281fbe12e4a63fb9ae4f8787738b Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Fri, 4 Oct 2002 08:49:26 +0000 Subject: [PATCH] 2002-10-04 Michael Koch * java/net/InetAddress.java: (isMulticastAddress): Added documentation. (getHostAddress): Added documentation. (toString): Added documentation. (getByAddress): Fixed documentation. (getByName): Added documentation. (getAllByName): Added documentation. (getLocalHost): Added documentation. From-SVN: r57814 --- libjava/ChangeLog | 11 +++++++++ libjava/java/net/InetAddress.java | 41 +++++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index d5108ada8b4..ff2671d0d95 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,14 @@ +2002-10-04 Michael Koch + + * java/net/InetAddress.java: + (isMulticastAddress): Added documentation. + (getHostAddress): Added documentation. + (toString): Added documentation. + (getByAddress): Fixed documentation. + (getByName): Added documentation. + (getAllByName): Added documentation. + (getLocalHost): Added documentation. + 2002-10-04 Michael Koch * java/beans/beancontext/BeanContextChildSupport.java: diff --git a/libjava/java/net/InetAddress.java b/libjava/java/net/InetAddress.java index 91e34909cfc..fcdd88cff78 100644 --- a/libjava/java/net/InetAddress.java +++ b/libjava/java/net/InetAddress.java @@ -12,6 +12,7 @@ package java.net; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.IOException; +import java.io.Serializable; /** * @author Per Bothner @@ -27,7 +28,7 @@ import java.io.IOException; * @specnote This class is not final since JK 1.4 */ -public class InetAddress implements java.io.Serializable +public class InetAddress implements Serializable { // The Serialized Form specifies that an int 'address' is saved/restored. // This class uses a byte array internally so we'll just do the conversion @@ -80,6 +81,11 @@ public class InetAddress implements java.io.Serializable family = getFamily (address); } + /** + * Utility routine to check if the InetAddress is an IP multicast address + * + * @since 1.1 + */ public boolean isMulticastAddress () { int len = addr.length; @@ -127,6 +133,11 @@ public class InetAddress implements java.io.Serializable } } + /** + * Returns the IP address as string + * + * @since 1.0.2 + */ public String getHostAddress () { StringBuffer sbuf = new StringBuffer(40); @@ -204,6 +215,9 @@ public class InetAddress implements java.io.Serializable return true; } + /** + * Returns then InetAddress as string + */ public String toString() { return getHostName()+'/'+getHostAddress(); @@ -215,7 +229,7 @@ public class InetAddress implements java.io.Serializable * The argument is in network byte order: the highest order byte of the * address is in getAddress()[0]. * - * @exception UnknownHostException If no IP address for the host could + * @exception UnknownHostException If IP address has illegal length * be found * * @since 1.4 @@ -236,6 +250,14 @@ public class InetAddress implements java.io.Serializable private static native InetAddress[] lookup (String hostname, InetAddress addr, boolean all); + /** + * Determines the IP address of a host, given the host's name. + * + * @exception UnknownHostException If no IP address for the host could + * be found + * @exception SecurityException If a security manager exists and its + * checkConnect method doesn't allow the operation + */ public static InetAddress getByName (String host) throws UnknownHostException { @@ -249,6 +271,15 @@ public class InetAddress implements java.io.Serializable return iaddr; } + /** + * Given the name of a host, returns an array of its IP addresses, + * based on the configured name service on the system. + * + * @exception UnknownHostException If no IP address for the host could + * be found + * @exception SecurityException If a security manager exists and its + * checkConnect method doesn't allow the operation + */ public static InetAddress[] getAllByName (String host) throws UnknownHostException { @@ -272,6 +303,12 @@ public class InetAddress implements java.io.Serializable private static InetAddress localhost = null; + /** + * Returns the local host + * + * @exception UnknownHostException If no IP address for the host could + * be found + */ public static InetAddress getLocalHost() throws UnknownHostException { SecurityManager s = System.getSecurityManager(); -- 2.30.2