2003-03-20 09:19:58 +01:00
|
|
|
/* InetAddress.java -- Class to model an Internet address
|
2005-04-26 23:44:26 +02:00
|
|
|
Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc.
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-03-20 09:19:58 +01:00
|
|
|
This file is part of GNU Classpath.
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-03-20 09:19:58 +01:00
|
|
|
GNU Classpath is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
any later version.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-03-20 09:19:58 +01:00
|
|
|
GNU Classpath is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with GNU Classpath; see the file COPYING. If not, write to the
|
|
|
|
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA.
|
|
|
|
|
|
|
|
Linking this library statically or dynamically with other modules is
|
|
|
|
making a combined work based on this library. Thus, the terms and
|
|
|
|
conditions of the GNU General Public License cover the whole
|
|
|
|
combination.
|
|
|
|
|
|
|
|
As a special exception, the copyright holders of this library give you
|
|
|
|
permission to link this library with independent modules to produce an
|
|
|
|
executable, regardless of the license terms of these independent
|
|
|
|
modules, and to copy and distribute the resulting executable under
|
|
|
|
terms of your choice, provided that you also meet, for each linked
|
|
|
|
independent module, the terms and conditions of the license of that
|
|
|
|
module. An independent module is a module which is not derived from
|
|
|
|
or based on this library. If you modify this library, you may extend
|
|
|
|
this exception to your version of the library, but you are not
|
|
|
|
obligated to do so. If you do not wish to do so, delete this
|
|
|
|
exception statement from your version. */
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2004-09-30 17:22:08 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
package java.net;
|
2002-10-10 07:19:22 +02:00
|
|
|
|
2003-10-02 17:17:13 +02:00
|
|
|
import gnu.classpath.Configuration;
|
2004-09-30 17:22:08 +02:00
|
|
|
|
2003-09-25 10:22:56 +02:00
|
|
|
import java.io.IOException;
|
2000-11-03 08:43:06 +01:00
|
|
|
import java.io.ObjectInputStream;
|
|
|
|
import java.io.ObjectOutputStream;
|
2002-10-10 07:19:22 +02:00
|
|
|
import java.io.ObjectStreamException;
|
2003-09-25 10:22:56 +02:00
|
|
|
import java.io.Serializable;
|
2003-05-02 11:27:59 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This class models an Internet address. It does not have a public
|
|
|
|
* constructor. Instead, new instances of this objects are created
|
|
|
|
* using the static methods getLocalHost(), getByName(), and
|
|
|
|
* getAllByName().
|
2004-09-30 17:22:08 +02:00
|
|
|
*
|
|
|
|
* <p>This class fulfills the function of the C style functions gethostname(),
|
2003-05-02 11:27:59 +02:00
|
|
|
* gethostbyname(), and gethostbyaddr(). It resolves Internet DNS names
|
2004-09-30 17:22:08 +02:00
|
|
|
* into their corresponding numeric addresses and vice versa.</p>
|
2003-05-02 11:27:59 +02:00
|
|
|
*
|
2004-09-30 17:22:08 +02:00
|
|
|
* @author Aaron M. Renn (arenn@urbanophile.com)
|
2003-05-02 11:27:59 +02:00
|
|
|
* @author Per Bothner
|
2002-10-03 19:17:39 +02:00
|
|
|
*
|
|
|
|
* @specnote This class is not final since JK 1.4
|
1999-04-07 16:42:40 +02:00
|
|
|
*/
|
2002-10-04 10:49:26 +02:00
|
|
|
public class InetAddress implements Serializable
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-06-18 10:09:48 +02:00
|
|
|
private static final long serialVersionUID = 3286316764910316507L;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
/**
|
|
|
|
* Dummy InetAddress, used to bind socket to any (all) network interfaces.
|
|
|
|
*/
|
2003-10-02 17:17:13 +02:00
|
|
|
static InetAddress ANY_IF;
|
2003-09-22 09:56:44 +02:00
|
|
|
|
2004-08-14 00:17:34 +02:00
|
|
|
private static final byte[] loopbackAddress = { 127, 0, 0, 1 };
|
|
|
|
|
|
|
|
private static final InetAddress loopback
|
2004-09-30 17:22:08 +02:00
|
|
|
= new Inet4Address(loopbackAddress, "localhost");
|
2003-09-22 09:56:44 +02:00
|
|
|
|
|
|
|
private static InetAddress localhost = null;
|
|
|
|
|
2003-10-02 17:17:13 +02:00
|
|
|
static
|
|
|
|
{
|
|
|
|
// load the shared library needed for name resolution
|
|
|
|
if (Configuration.INIT_LOAD_LIBRARY)
|
2004-09-30 17:22:08 +02:00
|
|
|
System.loadLibrary("javanet");
|
2003-10-02 17:17:13 +02:00
|
|
|
|
|
|
|
byte[] zeros = { 0, 0, 0, 0 };
|
2004-09-30 17:22:08 +02:00
|
|
|
ANY_IF = new Inet4Address(zeros, "0.0.0.0");
|
2003-10-02 17:17:13 +02:00
|
|
|
}
|
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
* at serialization time and leave the rest of the algorithm as is.
|
|
|
|
*/
|
2000-11-03 08:43:06 +01:00
|
|
|
private int address;
|
2003-09-22 09:56:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An array of octets representing an IP address.
|
|
|
|
*/
|
2000-11-03 08:43:06 +01:00
|
|
|
transient byte[] addr;
|
2003-09-22 09:56:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the host for this address.
|
|
|
|
*/
|
2000-11-03 08:43:06 +01:00
|
|
|
String hostName;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
/**
|
|
|
|
* The field 'family' seems to be the AF_ value.
|
|
|
|
* FIXME: Much of the code in the other java.net classes does not make
|
|
|
|
* use of this family field. A better implementation would be to make
|
|
|
|
* use of getaddrinfo() and have other methods just check the family
|
|
|
|
* field rather than examining the length of the address each time.
|
|
|
|
*/
|
2000-11-03 08:43:06 +01:00
|
|
|
int family;
|
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
/**
|
|
|
|
* Initializes this object's addr instance variable from the passed in
|
2005-04-19 21:07:13 +02:00
|
|
|
* byte array. Note that this constructor is protected and is called
|
2003-09-22 09:56:44 +02:00
|
|
|
* only by static methods in this class.
|
|
|
|
*
|
|
|
|
* @param ipaddr The IP number of this address as an array of bytes
|
|
|
|
* @param hostname The hostname of this IP address.
|
|
|
|
*/
|
2004-09-30 17:22:08 +02:00
|
|
|
InetAddress(byte[] ipaddr, String hostname)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2005-02-03 18:44:20 +01:00
|
|
|
addr = (null == ipaddr) ? null : (byte[]) ipaddr.clone();
|
2000-11-03 08:43:06 +01:00
|
|
|
hostName = hostname;
|
2003-06-18 10:09:48 +02:00
|
|
|
|
2004-09-30 17:22:08 +02:00
|
|
|
if (ipaddr != null)
|
|
|
|
family = getFamily(ipaddr);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
2003-09-25 10:22:56 +02:00
|
|
|
* Returns true if this address is a multicast address, false otherwise.
|
|
|
|
* An address is multicast if the high four bits are "1110". These are
|
|
|
|
* also known as "Class D" addresses.
|
|
|
|
*
|
|
|
|
* @return true if mulitcast, false if not
|
2002-10-04 10:49:26 +02:00
|
|
|
*
|
|
|
|
* @since 1.1
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMulticastAddress()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-09-29 13:53:23 +02:00
|
|
|
// Mask against high order bits of 1110
|
|
|
|
if (addr.length == 4)
|
2005-04-27 00:07:39 +02:00
|
|
|
return (addr[0] & 0xf0) == 0xe0;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-09-29 13:53:23 +02:00
|
|
|
// Mask against high order bits of 11111111
|
2003-09-29 14:05:41 +02:00
|
|
|
if (addr.length == 16)
|
2003-06-19 17:08:22 +02:00
|
|
|
return addr [0] == (byte) 0xFF;
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-10-10 07:19:22 +02:00
|
|
|
/**
|
|
|
|
* Utility routine to check if the InetAddress in a wildcard address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isAnyLocalAddress()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
return equals(ANY_IF);
|
2002-10-10 07:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Utility routine to check if the InetAddress is a loopback address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isLoopbackAddress()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
2005-04-27 00:07:39 +02:00
|
|
|
return (addr[0] & 0xff) == 0x7f;
|
2002-10-10 07:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
* Utility routine to check if InetAddress is a link local address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isLinkLocalAddress()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
|
|
|
// XXX: This seems to not exist with IPv4 addresses
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
* Utility routine to check if InetAddress is a site local address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isSiteLocalAddress()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
2005-04-27 00:07:39 +02:00
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// 10.0.0.0/8
|
2005-04-27 00:07:39 +02:00
|
|
|
if ((addr[0] & 0xff) == 0x0a)
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// 172.16.0.0/12
|
2005-04-27 00:07:39 +02:00
|
|
|
if ((addr[0] & 0xff) == 0xac && (addr[1] & 0xf0) == 0x10)
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// 192.168.0.0/16
|
2005-04-27 00:07:39 +02:00
|
|
|
if ((addr[0] & 0xff) == 0xc0 && (addr[1] & 0xff) == 0xa8)
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// XXX: Do we need to check more addresses here ?
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
* Utility routine to check if InetAddress is a global multicast address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMCGlobal()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
|
|
|
// XXX: This seems to not exist with IPv4 addresses
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-04-26 23:44:26 +02:00
|
|
|
* Utility routine to check if InetAddress is a node local multicast address.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMCNodeLocal()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
|
|
|
// XXX: This seems to not exist with IPv4 addresses
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-04-26 23:44:26 +02:00
|
|
|
* Utility routine to check if InetAddress is a link local multicast address.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMCLinkLocal()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
if (! isMulticastAddress())
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
return false;
|
|
|
|
|
2005-04-27 00:07:39 +02:00
|
|
|
return ((addr[0] & 0xff) == 0xe0
|
|
|
|
&& (addr[1] & 0xff) == 0x00
|
|
|
|
&& (addr[2] & 0xff) == 0x00);
|
2002-10-10 07:19:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-04-26 23:44:26 +02:00
|
|
|
* Utility routine to check if InetAddress is a site local multicast address.
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMCSiteLocal()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
|
|
|
// XXX: This seems to not exist with IPv4 addresses
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2005-04-26 23:44:26 +02:00
|
|
|
* Utility routine to check if InetAddress is a organization local
|
|
|
|
* multicast address.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public boolean isMCOrgLocal()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// This is the IPv4 implementation.
|
|
|
|
// Any class derived from InetAddress should override this.
|
|
|
|
// XXX: This seems to not exist with IPv4 addresses
|
2002-10-10 07:19:22 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Returns the hostname for this address. This will return the IP address
|
|
|
|
* as a String if there is no hostname available for this address
|
|
|
|
*
|
|
|
|
* @return The hostname for this address
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public String getHostName()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2004-09-30 17:22:08 +02:00
|
|
|
if (hostName != null)
|
|
|
|
return hostName;
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
|
2004-09-30 17:22:08 +02:00
|
|
|
// Lookup hostname and set field.
|
|
|
|
lookup (null, this, false);
|
|
|
|
|
2000-11-03 08:43:06 +01:00
|
|
|
return hostName;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-10-10 07:19:22 +02:00
|
|
|
/**
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
* Returns the canonical hostname represented by this InetAddress
|
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @since 1.4
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public String getCanonicalHostName()
|
2002-10-10 07:19:22 +02:00
|
|
|
{
|
2003-09-29 13:24:28 +02:00
|
|
|
SecurityManager sm = System.getSecurityManager();
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
if (sm != null)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2004-10-18 14:36:27 +02:00
|
|
|
sm.checkConnect(hostName, -1);
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
}
|
|
|
|
catch (SecurityException e)
|
|
|
|
{
|
2003-09-29 13:24:28 +02:00
|
|
|
return getHostAddress();
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try to find the FDQN now
|
2004-11-17 08:09:57 +01:00
|
|
|
InetAddress address;
|
|
|
|
byte[] ipaddr = getAddress();
|
|
|
|
|
|
|
|
if (ipaddr.length == 16)
|
|
|
|
address = new Inet6Address(getAddress(), null);
|
|
|
|
else
|
|
|
|
address = new Inet4Address(getAddress(), null);
|
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
return address.getHostName();
|
2002-10-10 07:19:22 +02:00
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Returns the IP address of this object as a byte array.
|
|
|
|
*
|
|
|
|
* @return IP address
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public byte[] getAddress()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
// An experiment shows that JDK1.2 returns a different byte array each
|
|
|
|
// time. This makes sense, in terms of security.
|
2003-09-29 13:24:28 +02:00
|
|
|
return (byte[]) addr.clone();
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper function due to a CNI limitation. */
|
|
|
|
private static InetAddress[] allocArray (int count)
|
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
return new InetAddress [count];
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Helper function due to a CNI limitation. */
|
|
|
|
private static SecurityException checkConnect (String hostname)
|
|
|
|
{
|
2003-09-29 13:24:28 +02:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (s == null)
|
|
|
|
return null;
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
try
|
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
s.checkConnect (hostname, -1);
|
1999-04-07 16:42:40 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
catch (SecurityException ex)
|
|
|
|
{
|
|
|
|
return ex;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
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
2004-04-20 15:05:10 +02:00
|
|
|
* Returns the IP address of this object as a String. The address is in
|
2003-09-29 13:53:23 +02:00
|
|
|
* the dotted octet notation, for example, "127.0.0.1".
|
|
|
|
*
|
|
|
|
* @return The IP address of this object in String form
|
2002-10-04 10:49:26 +02:00
|
|
|
*
|
|
|
|
* @since 1.0.2
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public String getHostAddress()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
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
2004-04-20 15:05:10 +02:00
|
|
|
StringBuffer sb = new StringBuffer(40);
|
|
|
|
|
2000-11-03 08:43:06 +01:00
|
|
|
int len = addr.length;
|
1999-04-07 16:42:40 +02:00
|
|
|
int i = 0;
|
2003-09-29 13:24:28 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (len == 16)
|
|
|
|
{ // An IPv6 address.
|
2003-09-29 13:24:28 +02:00
|
|
|
for ( ; ; i += 2)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
if (i >= 16)
|
2003-09-29 13:24:28 +02:00
|
|
|
return sb.toString();
|
|
|
|
|
2003-06-19 17:08:22 +02:00
|
|
|
int x = ((addr [i] & 0xFF) << 8) | (addr [i + 1] & 0xFF);
|
2003-09-29 13:24:28 +02:00
|
|
|
boolean empty = sb.length() == 0;
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (empty)
|
|
|
|
{
|
|
|
|
if (i == 10 && x == 0xFFFF)
|
|
|
|
{ // IPv4-mapped IPv6 address.
|
2003-09-29 13:24:28 +02:00
|
|
|
sb.append (":FFFF:");
|
1999-04-07 16:42:40 +02:00
|
|
|
break; // Continue as IPv4 address;
|
|
|
|
}
|
|
|
|
else if (i == 12)
|
|
|
|
{ // IPv4-compatible IPv6 address.
|
2003-09-29 13:24:28 +02:00
|
|
|
sb.append (':');
|
1999-04-07 16:42:40 +02:00
|
|
|
break; // Continue as IPv4 address.
|
|
|
|
}
|
|
|
|
else if (i > 0)
|
2003-09-29 13:24:28 +02:00
|
|
|
sb.append ("::");
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
else
|
2003-09-29 13:24:28 +02:00
|
|
|
sb.append (':');
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (x != 0 || i >= 14)
|
2003-09-29 13:24:28 +02:00
|
|
|
sb.append (Integer.toHexString (x).toUpperCase());
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
2003-09-29 13:24:28 +02:00
|
|
|
|
|
|
|
for ( ; ; )
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2004-09-30 17:22:08 +02:00
|
|
|
sb.append(addr[i] & 0xff);
|
|
|
|
i++;
|
2003-09-29 13:24:28 +02:00
|
|
|
|
2004-09-30 17:22:08 +02:00
|
|
|
if (i == len)
|
|
|
|
break;
|
2003-09-29 13:24:28 +02:00
|
|
|
|
2004-09-30 17:22:08 +02:00
|
|
|
sb.append('.');
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
return sb.toString();
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Returns a hash value for this address. Useful for creating hash
|
|
|
|
* tables. Overrides Object.hashCode()
|
|
|
|
*
|
|
|
|
* @return A hash value for this address.
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public int hashCode()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
// There hashing algorithm is not specified, but a simple experiment
|
|
|
|
// shows that it is equal to the address, as a 32-bit big-endian integer.
|
|
|
|
int hash = 0;
|
2000-11-03 08:43:06 +01:00
|
|
|
int len = addr.length;
|
1999-04-07 16:42:40 +02:00
|
|
|
int i = len > 4 ? len - 4 : 0;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
|
|
|
for (; i < len; i++)
|
2005-04-27 00:07:39 +02:00
|
|
|
hash = (hash << 8) | (addr[i] & 0xff);
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
return hash;
|
|
|
|
}
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Tests this address for equality against another InetAddress. The two
|
|
|
|
* addresses are considered equal if they contain the exact same octets.
|
|
|
|
* This implementation overrides Object.equals()
|
|
|
|
*
|
|
|
|
* @param obj The address to test for equality
|
|
|
|
*
|
|
|
|
* @return true if the passed in object's address is equal to this one's,
|
|
|
|
* false otherwise
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
*/
|
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
2004-04-20 15:05:10 +02:00
|
|
|
public boolean equals(Object obj)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-10-29 11:53:19 +01:00
|
|
|
if (! (obj instanceof InetAddress))
|
1999-04-07 16:42:40 +02:00
|
|
|
return false;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
// "The Java Class Libraries" 2nd edition says "If a machine has
|
|
|
|
// multiple names instances of InetAddress for different name of
|
|
|
|
// that same machine are not equal. This is because they have
|
|
|
|
// different host names." This violates the description in the
|
2002-10-03 19:17:39 +02:00
|
|
|
// JDK 1.2 API documentation. A little experimentation
|
1999-04-07 16:42:40 +02:00
|
|
|
// shows that the latter is correct.
|
2000-11-03 08:43:06 +01:00
|
|
|
byte[] addr2 = ((InetAddress) obj).addr;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-10-02 17:17:13 +02:00
|
|
|
if (addr.length != addr2.length)
|
1999-04-07 16:42:40 +02:00
|
|
|
return false;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-10-02 17:17:13 +02:00
|
|
|
for (int i = 0; i < addr.length; i++)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
if (addr[i] != addr2[i])
|
1999-04-07 16:42:40 +02:00
|
|
|
return false;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Converts this address to a String. This string contains the IP in
|
|
|
|
* dotted decimal form. For example: "127.0.0.1" This method is equivalent
|
|
|
|
* to getHostAddress() and overrides Object.toString()
|
|
|
|
*
|
|
|
|
* @return This address in String form
|
2002-10-04 10:49:26 +02:00
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public String toString()
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2004-11-16 16:33:49 +01:00
|
|
|
String addr = getHostAddress();
|
2005-04-26 23:55:30 +02:00
|
|
|
String host = (hostName != null) ? hostName : "";
|
2004-11-16 16:33:49 +01:00
|
|
|
return host + "/" + addr;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
2002-10-10 07:19:22 +02:00
|
|
|
|
2002-10-03 19:17:39 +02:00
|
|
|
/**
|
|
|
|
* Returns an InetAddress object given the raw IP address.
|
|
|
|
*
|
|
|
|
* The argument is in network byte order: the highest order byte of the
|
|
|
|
* address is in getAddress()[0].
|
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @param addr The IP address to create the InetAddress object from
|
|
|
|
*
|
2002-10-04 10:49:26 +02:00
|
|
|
* @exception UnknownHostException If IP address has illegal length
|
2002-10-03 19:17:39 +02:00
|
|
|
*
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
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
2004-04-20 15:05:10 +02:00
|
|
|
public static InetAddress getByAddress(byte[] addr)
|
2002-10-03 19:17:39 +02:00
|
|
|
throws UnknownHostException
|
|
|
|
{
|
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
2004-04-20 15:05:10 +02:00
|
|
|
return getByAddress(null, addr);
|
2002-10-03 19:17:39 +02:00
|
|
|
}
|
2002-10-10 07:19:22 +02:00
|
|
|
|
2002-10-05 09:49:08 +02:00
|
|
|
/**
|
2002-10-10 07:19:22 +02:00
|
|
|
* Creates an InetAddress based on the provided host name and IP address.
|
2002-10-05 09:49:08 +02:00
|
|
|
* No name service is checked for the validity of the address.
|
|
|
|
*
|
2002-10-10 07:19:22 +02:00
|
|
|
* @param host The hostname of the InetAddress object to create
|
|
|
|
* @param addr The IP address to create the InetAddress object from
|
|
|
|
*
|
2002-10-05 09:49:08 +02:00
|
|
|
* @exception UnknownHostException If IP address is of illegal length
|
|
|
|
*
|
|
|
|
* @since 1.4
|
|
|
|
*/
|
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
2004-04-20 15:05:10 +02:00
|
|
|
public static InetAddress getByAddress(String host, byte[] addr)
|
2002-10-05 09:49:08 +02:00
|
|
|
throws UnknownHostException
|
|
|
|
{
|
2002-10-10 07:19:22 +02:00
|
|
|
if (addr.length == 4)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
return new Inet4Address(addr, host);
|
2002-10-10 07:19:22 +02:00
|
|
|
|
|
|
|
if (addr.length == 16)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
return new Inet6Address(addr, host);
|
|
|
|
|
|
|
|
throw new UnknownHostException("IP address has illegal length");
|
2002-10-05 09:49:08 +02:00
|
|
|
}
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-06-18 10:09:48 +02:00
|
|
|
/**
|
2005-04-28 23:02:40 +02:00
|
|
|
* If hostname is a valid numeric IP address, return the numeric address.
|
2003-06-18 10:09:48 +02:00
|
|
|
* Otherwise, return null.
|
2005-04-19 21:07:13 +02:00
|
|
|
*
|
|
|
|
* @param hostname the name of the host
|
2003-06-18 10:09:48 +02:00
|
|
|
*/
|
2005-04-19 21:07:13 +02:00
|
|
|
private static native byte[] aton(String hostname);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2005-04-19 21:07:13 +02:00
|
|
|
/**
|
|
|
|
* Looks up all addresses of a given host.
|
|
|
|
*
|
|
|
|
* @param hostname the host to lookup
|
2005-04-28 23:02:40 +02:00
|
|
|
* @param ipaddr the IP address to lookup
|
|
|
|
* @param all return all known addresses for one host
|
2005-04-19 21:07:13 +02:00
|
|
|
*
|
|
|
|
* @return an array with all found addresses
|
|
|
|
*/
|
2003-11-30 22:02:56 +01:00
|
|
|
private static native InetAddress[] lookup (String hostname,
|
2005-04-19 21:07:13 +02:00
|
|
|
InetAddress ipaddr, boolean all);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2005-04-19 21:07:13 +02:00
|
|
|
/**
|
|
|
|
* Returns tha family type of an IP address.
|
|
|
|
*
|
|
|
|
* @param addr the IP address
|
|
|
|
*
|
|
|
|
* @return the family
|
|
|
|
*/
|
|
|
|
private static native int getFamily (byte[] ipaddr);
|
2003-09-22 09:56:44 +02:00
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Returns an InetAddress object representing the IP address of the given
|
|
|
|
* hostname. This name can be either a hostname such as "www.urbanophile.com"
|
|
|
|
* or an IP address in dotted decimal format such as "127.0.0.1". If the
|
2004-03-16 10:47:14 +01:00
|
|
|
* hostname is null or "", the hostname of the local machine is supplied by
|
2003-09-29 13:53:23 +02:00
|
|
|
* default. This method is equivalent to returning the first element in
|
|
|
|
* the InetAddress array returned from GetAllByName.
|
|
|
|
*
|
2004-08-14 00:17:34 +02:00
|
|
|
* @param hostname The name of the desired host, or null for the local
|
|
|
|
* loopback address.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2003-09-29 13:53:23 +02:00
|
|
|
* @return The address of the host as an InetAddress object.
|
2002-10-04 10:49:26 +02:00
|
|
|
*
|
|
|
|
* @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
|
|
|
|
*/
|
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
2004-04-20 15:05:10 +02:00
|
|
|
public static InetAddress getByName(String hostname)
|
1999-04-07 16:42:40 +02:00
|
|
|
throws UnknownHostException
|
|
|
|
{
|
2004-08-14 00:17:34 +02:00
|
|
|
// If null or the empty string is supplied, the loopback address
|
|
|
|
// is returned. Note that this is permitted without a security check.
|
|
|
|
if (hostname == null || hostname.length() == 0)
|
|
|
|
return loopback;
|
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2003-06-18 10:09:48 +02:00
|
|
|
if (s != null)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
s.checkConnect(hostname, -1);
|
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// Assume that the host string is an IP address
|
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
2004-04-20 15:05:10 +02:00
|
|
|
byte[] address = aton(hostname);
|
1999-04-07 16:42:40 +02:00
|
|
|
if (address != null)
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
{
|
|
|
|
if (address.length == 4)
|
|
|
|
return new Inet4Address (address, null);
|
|
|
|
else if (address.length == 16)
|
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
if ((address [10] == 0xFF) && (address [11] == 0xFF))
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
byte[] ip4addr = new byte [4];
|
|
|
|
ip4addr [0] = address [12];
|
|
|
|
ip4addr [1] = address [13];
|
|
|
|
ip4addr [2] = address [14];
|
|
|
|
ip4addr [3] = address [15];
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
return new Inet4Address (ip4addr, null);
|
|
|
|
}
|
|
|
|
return new Inet6Address (address, null);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw new UnknownHostException ("Address has invalid length");
|
|
|
|
}
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// Try to resolve the host by DNS
|
2004-08-14 00:17:34 +02:00
|
|
|
InetAddress result = new InetAddress(null, null);
|
|
|
|
lookup (hostname, result, false);
|
|
|
|
return result;
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
2003-09-29 13:53:23 +02:00
|
|
|
* Returns an array of InetAddress objects representing all the host/ip
|
|
|
|
* addresses of a given host, given the host's name. This name can be
|
|
|
|
* either a hostname such as "www.urbanophile.com" or an IP address in
|
|
|
|
* dotted decimal format such as "127.0.0.1". If the value is null, the
|
|
|
|
* hostname of the local machine is supplied by default.
|
|
|
|
*
|
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
2004-04-20 15:05:10 +02:00
|
|
|
* @param hostname The name of the desired host, or null for the
|
2004-08-14 00:17:34 +02:00
|
|
|
* local loopback address.
|
2002-10-04 10:49:26 +02:00
|
|
|
*
|
2003-09-29 13:53:23 +02:00
|
|
|
* @return All addresses of the host as an array of InetAddress objects.
|
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
2004-04-20 15:05:10 +02:00
|
|
|
*
|
2002-10-04 10:49:26 +02:00
|
|
|
* @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
|
|
|
|
*/
|
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
2004-04-20 15:05:10 +02:00
|
|
|
public static InetAddress[] getAllByName(String hostname)
|
1999-04-07 16:42:40 +02:00
|
|
|
throws UnknownHostException
|
|
|
|
{
|
2004-08-14 00:17:34 +02:00
|
|
|
// If null or the empty string is supplied, the loopback address
|
|
|
|
// is returned. Note that this is permitted without a security check.
|
|
|
|
if (hostname == null || hostname.length() == 0)
|
|
|
|
return new InetAddress[] {loopback};
|
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2003-06-18 10:09:48 +02:00
|
|
|
if (s != null)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
s.checkConnect(hostname, -1);
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
|
|
|
|
// Check if hostname is an IP address
|
|
|
|
byte[] address = aton (hostname);
|
1999-04-07 16:42:40 +02:00
|
|
|
if (address != null)
|
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
InetAddress[] result = new InetAddress [1];
|
|
|
|
result [0] = new InetAddress (address, null);
|
1999-04-07 16:42:40 +02:00
|
|
|
return result;
|
|
|
|
}
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2002-11-01 Michael Koch <konqueror@gmx.de>
* java/net/InetAddress.java:
(isAnyLocalAddress): Implemented.
(isLoopbackAddress): Implemented, comment added.
(isLinkLocalAddress): Implemented, documentation added.
(isSiteLocalAddress): Implemented, documentation added.
(isMCGlobal): Implemented, documentation added.
(isMCNodeLocal): Implemented, documentation added.
(isMCLinkLocal): Implemented, documentation added.
(isMCSiteLocal): Implemented, documentation added.
(isMCOrgLocal): Implemented, documentation added.
(getHostName): Documentation added.
(getCanonicalHostName): Implemented, documentation added.
(getAddress): Documentation added.
(hashCode): Documentation added.
(equals): Documentation added.
(toString): Fixed implementation.
(getByAddress): Use Inet4Address and Inet6Address.
(lookup): New linewrap.
(getByName): SecurityManager check added, support Inet4Address and
Inet6address, comments added.
(getAllByName): SecurityManager check added, comments added.
* java/net/Inet6Address.java:
(Inet6Address): Initialize parent class with addr instead of null.
* java/net/URL.java
(equals): Documentation added.
(getFile): Documentation added.
(hashCode): Documentation added.
* java/net/natInetAddress.cc:
(aton): Fix IPv6 support.
* java/net/natPlainDatagramSocketImpl.cc:
(peek): Throw PortUnreachableException when suitable.
(peekData): Throw PortUnreachableException when suitable.
(send): Throw PortUnreachableException when suitable.
(receive): Throw PortUnreachableException when suitable.
From-SVN: r58704
2002-11-01 07:35:14 +01:00
|
|
|
// Try to resolve the hostname by DNS
|
|
|
|
return lookup (hostname, null, true);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2004-03-20 18:59:39 +01:00
|
|
|
/**
|
|
|
|
* This native method looks up the hostname of the local machine
|
|
|
|
* we are on. If the actual hostname cannot be determined, then the
|
|
|
|
* value "localhost" will be used. This native method wrappers the
|
|
|
|
* "gethostname" function.
|
|
|
|
*
|
|
|
|
* @return The local hostname.
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
private static native String getLocalHostname();
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2002-10-04 10:49:26 +02:00
|
|
|
/**
|
2003-10-02 17:17:13 +02:00
|
|
|
* Returns an InetAddress object representing the address of the current
|
|
|
|
* host.
|
|
|
|
*
|
|
|
|
* @return The local host's address
|
2002-10-04 10:49:26 +02:00
|
|
|
*
|
|
|
|
* @exception UnknownHostException If no IP address for the host could
|
|
|
|
* be found
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
public static InetAddress getLocalHost() throws UnknownHostException
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
2003-09-29 13:24:28 +02:00
|
|
|
SecurityManager s = System.getSecurityManager();
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
// Experimentation shows that JDK1.2 does cache the result.
|
|
|
|
// However, if there is a security manager, and the cached result
|
|
|
|
// is other than "localhost", we need to check again.
|
|
|
|
if (localhost == null
|
2004-08-14 00:17:34 +02:00
|
|
|
|| (s != null && ! localhost.isLoopbackAddress()))
|
2003-06-19 17:08:22 +02:00
|
|
|
getLocalHost (s);
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
return localhost;
|
|
|
|
}
|
|
|
|
|
2003-06-19 17:08:22 +02:00
|
|
|
private static synchronized void getLocalHost (SecurityManager s)
|
1999-04-07 16:42:40 +02:00
|
|
|
throws UnknownHostException
|
|
|
|
{
|
|
|
|
// Check the localhost cache again, now that we've synchronized.
|
|
|
|
if (s == null && localhost != null)
|
|
|
|
return;
|
2003-06-18 10:09:48 +02:00
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
String hostname = getLocalHostname();
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (s != null)
|
|
|
|
{
|
|
|
|
// "The Java Class Libraries" suggests that if the security
|
|
|
|
// manager disallows getting the local host name, then
|
|
|
|
// we use the loopback host.
|
|
|
|
// However, the JDK 1.2 API claims to throw SecurityException,
|
|
|
|
// which seems to suggest SecurityException is *not* caught.
|
|
|
|
// In this case, experimentation shows that former is correct.
|
|
|
|
try
|
|
|
|
{
|
|
|
|
// This is wrong, if the name returned from getLocalHostname()
|
|
|
|
// is not a fully qualified name. FIXME.
|
2003-06-19 17:08:22 +02:00
|
|
|
s.checkConnect (hostname, -1);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
catch (SecurityException ex)
|
|
|
|
{
|
|
|
|
hostname = null;
|
|
|
|
}
|
|
|
|
}
|
2003-06-18 10:09:48 +02:00
|
|
|
|
2005-01-09 19:57:32 +01:00
|
|
|
if (hostname != null && hostname.length() != 0)
|
1999-04-07 16:42:40 +02:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
2003-06-19 17:08:22 +02:00
|
|
|
localhost = new InetAddress (null, null);
|
|
|
|
lookup (hostname, localhost, false);
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
2005-01-09 19:57:32 +01:00
|
|
|
else
|
|
|
|
throw new UnknownHostException();
|
2003-06-18 10:09:48 +02:00
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if (localhost == null)
|
2004-08-14 00:17:34 +02:00
|
|
|
localhost = new InetAddress (loopbackAddress, "localhost");
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
2003-09-22 09:56:44 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Needed for serialization
|
|
|
|
*/
|
2003-09-29 13:24:28 +02:00
|
|
|
private void readResolve() throws ObjectStreamException
|
2003-09-22 09:56:44 +02:00
|
|
|
{
|
|
|
|
// FIXME: implement this
|
|
|
|
}
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
|
|
|
private void readObject(ObjectInputStream ois)
|
2003-09-22 09:56:44 +02:00
|
|
|
throws IOException, ClassNotFoundException
|
|
|
|
{
|
2003-09-29 13:24:28 +02:00
|
|
|
ois.defaultReadObject();
|
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
2004-04-20 15:05:10 +02:00
|
|
|
addr = new byte[4];
|
|
|
|
addr[3] = (byte) address;
|
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
for (int i = 2; i >= 0; --i)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
addr[i] = (byte) (address >>= 8);
|
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
// Ignore family from serialized data. Since the saved address is 32 bits
|
|
|
|
// the deserialized object will have an IPv4 address i.e. AF_INET family.
|
|
|
|
// FIXME: An alternative is to call the aton method on the deserialized
|
|
|
|
// hostname to get a new address. The Serialized Form doc is silent
|
|
|
|
// on how these fields are used.
|
|
|
|
family = getFamily (addr);
|
|
|
|
}
|
|
|
|
|
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
2004-04-20 15:05:10 +02:00
|
|
|
private void writeObject(ObjectOutputStream oos) throws IOException
|
2003-09-22 09:56:44 +02:00
|
|
|
{
|
|
|
|
// Build a 32 bit address from the last 4 bytes of a 4 byte IPv4 address
|
|
|
|
// or a 16 byte IPv6 address.
|
|
|
|
int len = addr.length;
|
|
|
|
int i = len - 4;
|
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
2004-04-20 15:05:10 +02:00
|
|
|
|
2003-09-22 09:56:44 +02:00
|
|
|
for (; i < len; i++)
|
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
2004-04-20 15:05:10 +02:00
|
|
|
address = address << 8 | (((int) addr[i]) & 0xFF);
|
|
|
|
|
2003-09-29 13:24:28 +02:00
|
|
|
oos.defaultWriteObject();
|
2003-09-22 09:56:44 +02:00
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|