diff options
author | Michael Koch <konqueror@gmx.de> | 2002-10-03 11:23:33 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2002-10-03 11:23:33 +0000 |
commit | e832ab3c91f01cdb1bd618ffe4a8e00505264d22 (patch) | |
tree | aff5f3ab2e4d52928ed330a39300502da4fdce8b /libjava/java/net/URLStreamHandler.java | |
parent | 3eacc81d00aa85d20a95069177f608edb4f8104c (diff) | |
download | gcc-e832ab3c91f01cdb1bd618ffe4a8e00505264d22.zip gcc-e832ab3c91f01cdb1bd618ffe4a8e00505264d22.tar.gz gcc-e832ab3c91f01cdb1bd618ffe4a8e00505264d22.tar.bz2 |
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
Diffstat (limited to 'libjava/java/net/URLStreamHandler.java')
-rw-r--r-- | libjava/java/net/URLStreamHandler.java | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index cade4f3..9c6ba25 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -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) { @@ -207,6 +224,36 @@ public abstract class URLStreamHandler } /** + * 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 * * @param u The URL to convert |