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
This commit is contained in:
parent
cf6f7d5589
commit
f6d49f66ec
45 changed files with 1979 additions and 1905 deletions
|
@ -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
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue