2002-10-08 Michael Koch <konqueror@gmx.de>

* java/net/HttpURLConnection.java
	(getPermission): New method.
	(getErrorStream): New stub method.
	(getHeaderFieldDate): New stub method.
	* java/net/Inet4Address.java:
	(isLinkLocalAddress): Typo fixed.
	* java/net/InetAddress.java:
	(readResolve): New stubbed method (for serialization).
	(isAnyLocalAddress): New stubbed method.
	(isLoopbackAddress): New stubbed method.
	(isLinkLocalAddress): New stubbed method.
	(isSiteLocalAddress): New stubbed method.
	(isMCGlobal): New stubbed method.
	(isMCNodeGlobal): New stubbed method.
	(isMCLinkLocal): New stubbed method.
	(isMCSiteLocal): New stubbed method.
	(isMCOrgLocal): New stubbed method.
	(getCanonicalHostName): New stubbed method.
	(getByAddress): Create instances of Inet4Address/Inet6Address,
	instead of InetAddress, documentation added.
	* java/net/MulticastSocket.java
	(getInterface): Removed FIXME.
	(getNetworkInterface): New method.
	(setNetworkInterface): New method.
	* java/net/NetworkInterface.java:
	(toString): Use property "line.separator" instead of "\n".
	* java/net/URLConnection.java
	(getContent): New stubbed method.
	* java/net/URLStreamHandler.java:
	(equals): New stubbed method.
	(hostsEqual): New stubbed method.
	(hashCode): New stubbed method.
	* java/net/natNetworkInterface.cc:
	(getRealNetworkInterfaces): Create Inet4Address object
	instead of InetAddress.

From-SVN: r58002
This commit is contained in:
Michael Koch
2002-10-10 05:19:22 +00:00
committed by Michael Koch
parent 402a402cab
commit 7393decb70
9 changed files with 299 additions and 18 deletions
+118 -5
View File
@@ -9,10 +9,12 @@ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package java.net;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
import java.io.Serializable;
import java.io.ObjectStreamException;
/**
* @author Per Bothner
@@ -44,6 +46,14 @@ public class InetAddress implements Serializable
int family;
private static final long serialVersionUID = 3286316764910316507L;
/**
* Needed for serialization
*/
private void readResolve () throws ObjectStreamException
{
// FIXME: implement this
}
private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException
{
@@ -96,6 +106,91 @@ public class InetAddress implements Serializable
return false;
}
/**
* Utility routine to check if the InetAddress in a wildcard address
*
* @since 1.4
*/
public boolean isAnyLocalAddress ()
{
// FIXME: implement this
return false;
}
/**
* Utility routine to check if the InetAddress is a loopback address
*
* @since 1.4
*/
public boolean isLoopbackAddress ()
{
// FIXME: implement this
return addr [0] == 0x7F;
}
/**
* @since 1.4
*/
public boolean isLinkLocalAddress ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isSiteLocalAddress ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isMCGlobal ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isMCNodeLocal ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isMCLinkLocal ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isMCSiteLocal ()
{
// FIXME: implement this
return false;
}
/**
* @since 1.4
*/
public boolean isMCOrgLocal ()
{
// FIXME: implement this
return false;
}
public String getHostName ()
{
if (hostName == null)
@@ -103,6 +198,15 @@ public class InetAddress implements Serializable
return hostName;
}
/**
* @since 1.4
*/
public String getCanonicalHostName ()
{
// FIXME: implement this
return "";
}
public byte[] getAddress ()
{
// An experiment shows that JDK1.2 returns a different byte array each
@@ -199,6 +303,7 @@ public class InetAddress implements Serializable
{
if (obj == null || ! (obj instanceof InetAddress))
return false;
// "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
@@ -222,13 +327,15 @@ public class InetAddress implements Serializable
{
return getHostName()+'/'+getHostAddress();
}
/**
* 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].
*
* @param addr The IP address to create the InetAddress object from
*
* @exception UnknownHostException If IP address has illegal length
*
* @since 1.4
@@ -241,11 +348,14 @@ public class InetAddress implements Serializable
return new InetAddress (addr, "");
}
/**
* Create an InetAddress based on the provided host name and IP address.
* Creates an InetAddress based on the provided host name and IP address.
* No name service is checked for the validity of the address.
*
* @param host The hostname of the InetAddress object to create
* @param addr The IP address to create the InetAddress object from
*
* @exception UnknownHostException If IP address is of illegal length
*
* @since 1.4
@@ -253,8 +363,11 @@ public class InetAddress implements Serializable
public static InetAddress getByAddress (String host, byte[] addr)
throws UnknownHostException
{
if (addr.length == 4 || addr.length == 16)
return new InetAddress (addr, host);
if (addr.length == 4)
return new Inet4Address (addr, host);
if (addr.length == 16)
return new Inet6Address (addr, host);
throw new UnknownHostException ("IP address has illegal length");
}