2002-09-30 Michael Koch <konqueror@gmx.de>

* java/net/DatagramSocket.java
	(receive): Check with SecurityManager AFTER the packet is received,
	check if connected to multicast address, documentation added.
	(send): Only check SecurityManager if connected, check address of
	packet to send.
	(connect): Implemented, documentation added.
	* java/net/Inet6Address.java: New file (not added yet to Makefile.am).
	* java/net/InetSocketAddress.java
	(whole file): Reindented.
	(hostname): New attribute.
	(InetSocketAddress): Initialize new attribute.
	(getAddress): Documentation added.
	(getHostName): Documentation added.
	(getPort): Documentation added.
	(hashCode): Documentation added.
	(isUnresolved): Documentation added.
	(toString): Conform to output of JDK 1.4.1, documentation added.
	* java/net/MulticastSocket.java
	(joinGroup): Removed FIXME, documentation added.
	(leaveGroup): Removed FIXME, documentation added.
	(send): Documentation added.
	* java/net/Socket.java
	(inputShutdown): New variable.
	(outputShutdown): New variable.
	(Socket): Initialize new variables.
	(getRemoteSocketAddress): Check if connected.
	(shutdownInput): Set new variable.
	(shutdownOutput): Set new variable.
	(isConnected): New method.
	(isClosed): New method.
	(isInputShutdown): New method.
	(isOutputShutdown): New method.
	* java/net/URLStreamHandler.java
	(URLStreamHandler): New method.
	(openConnection): Added documentation.
	(parseURL): Added documentation.
	(getHostAddress): New method.
	(getDefaultPort): New method.

From-SVN: r57772
This commit is contained in:
Michael Koch 2002-10-03 11:23:33 +00:00 committed by Michael Koch
parent 3eacc81d00
commit e832ab3c91
7 changed files with 596 additions and 120 deletions

View file

@ -25,6 +25,19 @@ import java.io.IOException;
public abstract class URLStreamHandler
{
/**
* Creates a URLStreamHander
*/
public URLStreamHandler ()
{
}
/**
* Opens a connection to the object referenced by the URL argument.
* This method should be overridden by a subclass.
*
* @exception IOException If an error occurs
*/
protected abstract URLConnection openConnection(URL u)
throws IOException;
@ -33,8 +46,12 @@ public abstract class URLStreamHandler
*
* @param u The URL to parse
* @param spec The specification to use
* @param start FIXME
* @param limit FIXME
* @param start The character index at which to begin parsing. This is just
* past the ':' (if there is one) that specifies the determination of the
* protocol name
* @param limit The character position to stop parsing at. This is the end
* of the string or the position of the "#" character, if present. All
* information after the sharp sign indicates an anchor
*/
protected void parseURL(URL u, String spec, int start, int limit)
{
@ -206,6 +223,36 @@ public abstract class URLStreamHandler
u.set(protocol, host, port, authority, userInfo, path, query, ref);
}
/**
* Get the IP address of our host. An empty host field or a DNS failure will
* result in a null return.
*/
protected InetAddress getHostAddress (URL url)
{
String hostname = url.getHost ();
if (hostname == "")
return null;
try
{
return InetAddress.getByName (hostname);
}
catch (UnknownHostException e)
{
return null;
}
}
/**
* Returns the default port for a URL parsed by this handler. This method is
* meant to be overidden by handlers with default port numbers.
*/
protected int getDefaultPort ()
{
return -1;
}
/**
* Converts an URL of a specific protocol to a string
*