diff options
author | Michael Koch <konqueror@gmx.de> | 2004-04-20 13:05:10 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2004-04-20 13:05:10 +0000 |
commit | f6d49f66ec0e0a59285d304720cc3bfa18f28141 (patch) | |
tree | 61e0c356000f77339048c144863ae045f79523eb /libjava/java/net/InetSocketAddress.java | |
parent | cf6f7d55897e0c6b1badbcfc241e512a4bb154b8 (diff) | |
download | gcc-f6d49f66ec0e0a59285d304720cc3bfa18f28141.zip gcc-f6d49f66ec0e0a59285d304720cc3bfa18f28141.tar.gz gcc-f6d49f66ec0e0a59285d304720cc3bfa18f28141.tar.bz2 |
Authenticator.java, [...]: Fixed javadocs, coding style and argument names all over.
2004-04-20 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java,
java/net/BindException.java,
java/net/ConnectException.java,
java/net/ContentHandler.java,
java/net/ContentHandlerFactory.java,
java/net/DatagramPacket.java,
java/net/DatagramSocket.java,
java/net/DatagramSocketImpl.java,
java/net/DatagramSocketImplFactory.java,
java/net/FileNameMap.java,
java/net/HttpURLConnection.java,
java/net/Inet4Address.java,
java/net/Inet6Address.java,
java/net/InetAddress.java,
java/net/InetSocketAddress.java,
java/net/JarURLConnection.java,
java/net/MalformedURLException.java,
java/net/MulticastSocket.java,
java/net/NetPermission.java,
java/net/NetworkInterface.java,
java/net/NoRouteToHostException.java,
java/net/PasswordAuthentication.java,
java/net/PortUnreachableException.java,
java/net/ProtocolException.java,
java/net/ServerSocket.java,
java/net/Socket.java,
java/net/SocketAddress.java,
java/net/SocketException.java,
java/net/SocketImpl.java,
java/net/SocketImplFactory.java,
java/net/SocketOptions.java,
java/net/SocketPermission.java,
java/net/SocketTimeoutException.java,
java/net/URI.java,
java/net/URISyntaxException.java,
java/net/URL.java,
java/net/URLClassLoader.java,
java/net/URLConnection.java,
java/net/URLDecoder.java,
java/net/URLEncoder.java,
java/net/URLStreamHandler.java,
java/net/URLStreamHandlerFactory.java,
java/net/UnknownHostException.java,
java/net/UnknownServiceException.java:
Fixed javadocs, coding style and argument names all over.
From-SVN: r80900
Diffstat (limited to 'libjava/java/net/InetSocketAddress.java')
-rw-r--r-- | libjava/java/net/InetSocketAddress.java | 70 |
1 files changed, 34 insertions, 36 deletions
diff --git a/libjava/java/net/InetSocketAddress.java b/libjava/java/net/InetSocketAddress.java index f0a27e3..5dc63dc 100644 --- a/libjava/java/net/InetSocketAddress.java +++ b/libjava/java/net/InetSocketAddress.java @@ -1,4 +1,4 @@ -/* InetSocketAddress.java -- +/* InetSocketAddress.java -- Copyright (C) 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,21 +37,21 @@ exception statement from your version. */ package java.net; -/** + +/** * InetSocketAddress instances represent socket addresses * in the java.nio package. They encapsulate a InetAddress and * a port number. * * @since 1.4 */ - public class InetSocketAddress extends SocketAddress { /** * Compatible with JDK 1.4+ */ private static final long serialVersionUID = 5076001401234631237L; - + /** * Name of host. */ @@ -66,10 +66,10 @@ public class InetSocketAddress extends SocketAddress * Port of host. */ private int port; - + /** * Constructs an InetSocketAddress instance. - * + * * @param addr Address of the socket * @param port Port if the socket * @@ -79,34 +79,33 @@ public class InetSocketAddress extends SocketAddress throws IllegalArgumentException { if (port < 0 || port > 65535) - throw new IllegalArgumentException ("Bad port number: " + port); + throw new IllegalArgumentException("Bad port number: " + port); if (addr == null) addr = InetAddress.ANY_IF; - + this.addr = addr; this.port = port; - this.hostname = addr.getHostName (); + this.hostname = addr.getHostName(); } /** * Constructs an InetSocketAddress instance. - * + * * @param port Port if the socket * * @exception IllegalArgumentException If the port number is illegal */ - public InetSocketAddress(int port) - throws IllegalArgumentException + public InetSocketAddress(int port) throws IllegalArgumentException { - this ((InetAddress) null, port); + this((InetAddress) null, port); } /** * Constructs an InetSocketAddress instance. * - * @param addr Address of the socket - * @param port Port if the socket + * @param hostname The hostname for the socket address + * @param port The port for the socket address * * @exception IllegalArgumentException If the port number is illegal */ @@ -114,49 +113,48 @@ public class InetSocketAddress extends SocketAddress throws IllegalArgumentException { if (hostname == null) - throw new IllegalArgumentException ("Null host name value"); - + throw new IllegalArgumentException("Null host name value"); + if (port < 0 || port > 65535) - throw new IllegalArgumentException ("Bad port number: " + port); + throw new IllegalArgumentException("Bad port number: " + port); this.port = port; this.hostname = hostname; try { - this.addr = InetAddress.getByName(hostname); + this.addr = InetAddress.getByName(hostname); } catch (Exception e) // UnknownHostException, SecurityException { - this.addr = null; + this.addr = null; } } - - /** + + /** * Test if obj is a <code>InetSocketAddress</code> and * has the same address and port * * @param obj The obj to compare this address with. * - * @return True if obj is equal. + * @return True if obj is equal. */ - public final boolean equals (Object obj) + public final boolean equals(Object obj) { // InetSocketAddress objects are equal when addr and port are equal. // The hostname may differ. - if (obj instanceof InetSocketAddress) { - InetSocketAddress sa = (InetSocketAddress) obj; - - if (addr == null && sa.addr != null) - return false; - else if (addr == null && sa.addr == null) - return hostname.equals (sa.hostname) && sa.port == port; - else - return addr.equals (sa.addr) && sa.port == port; + InetSocketAddress sa = (InetSocketAddress) obj; + + if (addr == null && sa.addr != null) + return false; + else if (addr == null && sa.addr == null) + return hostname.equals(sa.hostname) && sa.port == port; + else + return addr.equals(sa.addr) && sa.port == port; } - + return false; } @@ -190,7 +188,7 @@ public class InetSocketAddress extends SocketAddress { return port; } - + /** * Returns the hashcode of the <code>InetSocketAddress</code> * @@ -210,7 +208,7 @@ public class InetSocketAddress extends SocketAddress { return addr == null; } - + /** * Returns the <code>InetSocketAddress</code> as string * |