InetAddress.java: Merged class documentation with classpath.
2003-05-02 Michael Koch <konqueror@gmx.de> * java/net/InetAddress.java: Merged class documentation with classpath. * java/net/JarURLConnection.java: Explicitely import all used classes. * java/net/URL.java: Reformatting. * java/net/ServerSocket.java, java/net/Socket.java: New versions from classpath. From-SVN: r66376
This commit is contained in:
parent
9ab94a932c
commit
143f596a09
6 changed files with 126 additions and 18 deletions
|
@ -1,3 +1,15 @@
|
||||||
|
2003-05-02 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
|
* java/net/InetAddress.java:
|
||||||
|
Merged class documentation with classpath.
|
||||||
|
* java/net/JarURLConnection.java:
|
||||||
|
Explicitely import all used classes.
|
||||||
|
* java/net/URL.java:
|
||||||
|
Reformatting.
|
||||||
|
* java/net/ServerSocket.java,
|
||||||
|
java/net/Socket.java:
|
||||||
|
New versions from classpath.
|
||||||
|
|
||||||
2003-05-02 Michael Koch <konqueror@gmx.de>
|
2003-05-02 Michael Koch <konqueror@gmx.de>
|
||||||
|
|
||||||
* gnu/java/nio/FileChannelImpl.java
|
* gnu/java/nio/FileChannelImpl.java
|
||||||
|
|
|
@ -44,20 +44,28 @@ import java.io.IOException;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.io.ObjectStreamException;
|
import java.io.ObjectStreamException;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Per Bothner
|
|
||||||
* @date January 6, 1999.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Written using on-line Java Platform 1.2 API Specification, as well
|
* Written using on-line Java Platform 1.2 API Specification, as well
|
||||||
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
|
||||||
* (The latter turns out to have some errors ...)
|
* (The latter turns out to have some errors ...)
|
||||||
* Status: Believed complete and correct.
|
* Status: Believed complete and correct.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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().
|
||||||
|
* <p>
|
||||||
|
* This class fulfills the function of the C style functions gethostname(),
|
||||||
|
* gethostbyname(), and gethostbyaddr(). It resolves Internet DNS names
|
||||||
|
* into their corresponding numeric addresses and vice versa.
|
||||||
|
*
|
||||||
|
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||||
|
* @author Per Bothner
|
||||||
*
|
*
|
||||||
* @specnote This class is not final since JK 1.4
|
* @specnote This class is not final since JK 1.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class InetAddress implements Serializable
|
public class InetAddress implements Serializable
|
||||||
{
|
{
|
||||||
// The Serialized Form specifies that an int 'address' is saved/restored.
|
// The Serialized Form specifies that an int 'address' is saved/restored.
|
||||||
|
|
|
@ -38,10 +38,16 @@ exception statement from your version. */
|
||||||
|
|
||||||
package java.net;
|
package java.net;
|
||||||
|
|
||||||
import java.net.*;
|
import java.io.BufferedInputStream;
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.util.jar.*;
|
import java.io.InputStream;
|
||||||
import java.util.zip.*;
|
import java.io.IOException;
|
||||||
|
import java.util.jar.Attributes;
|
||||||
|
import java.util.jar.JarEntry;
|
||||||
|
import java.util.jar.JarFile;
|
||||||
|
import java.util.jar.JarInputStream;
|
||||||
|
import java.util.jar.Manifest;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
@ -52,8 +58,6 @@ import java.security.cert.Certificate;
|
||||||
* @since 1.2
|
* @since 1.2
|
||||||
* @date Aug 10, 1999.
|
* @date Aug 10, 1999.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public abstract class JarURLConnection extends URLConnection
|
public abstract class JarURLConnection extends URLConnection
|
||||||
{
|
{
|
||||||
// three different ways to say the same thing
|
// three different ways to say the same thing
|
||||||
|
|
|
@ -164,10 +164,51 @@ public class ServerSocket
|
||||||
if (bindAddr == null)
|
if (bindAddr == null)
|
||||||
bindAddr = InetAddress.ANY_IF;
|
bindAddr = InetAddress.ANY_IF;
|
||||||
|
|
||||||
|
// create socket
|
||||||
impl.create(true);
|
impl.create(true);
|
||||||
|
|
||||||
|
// bind to address/port
|
||||||
|
try
|
||||||
|
{
|
||||||
impl.bind(bindAddr, port);
|
impl.bind(bindAddr, port);
|
||||||
|
}
|
||||||
|
catch (IOException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (RuntimeException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (Error error)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// listen on socket
|
||||||
|
try
|
||||||
|
{
|
||||||
impl.listen(backlog);
|
impl.listen(backlog);
|
||||||
}
|
}
|
||||||
|
catch (IOException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (RuntimeException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (Error error)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the server socket to a specified socket address
|
* Binds the server socket to a specified socket address
|
||||||
|
|
|
@ -291,17 +291,60 @@ public class Socket
|
||||||
if (sm != null)
|
if (sm != null)
|
||||||
sm.checkConnect(raddr.getHostName(), rport);
|
sm.checkConnect(raddr.getHostName(), rport);
|
||||||
|
|
||||||
|
// create socket
|
||||||
impl.create(stream);
|
impl.create(stream);
|
||||||
|
|
||||||
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
|
// FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
|
||||||
// i.e. '0' and if localAddr is unspecified, use getLocalAddress() as
|
// i.e. '0' and if localAddr is unspecified, use getLocalAddress() as
|
||||||
// that default. JDK 1.2 doc infers not to do a bind.
|
// that default. JDK 1.2 doc infers not to do a bind.
|
||||||
|
|
||||||
|
// bind/connect to address/port
|
||||||
if (laddr != null)
|
if (laddr != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
impl.bind(laddr, lport);
|
impl.bind(laddr, lport);
|
||||||
|
}
|
||||||
|
catch (IOException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (RuntimeException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (Error error)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (raddr != null)
|
if (raddr != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
impl.connect(raddr, rport);
|
impl.connect(raddr, rport);
|
||||||
}
|
}
|
||||||
|
catch (IOException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (RuntimeException exception)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw exception;
|
||||||
|
}
|
||||||
|
catch (Error error)
|
||||||
|
{
|
||||||
|
impl.close();
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Binds the socket to the givent local address/port
|
* Binds the socket to the givent local address/port
|
||||||
|
|
|
@ -99,7 +99,7 @@ import java.util.StringTokenizer;
|
||||||
* Please note that a protocol handler must be a subclass of
|
* Please note that a protocol handler must be a subclass of
|
||||||
* URLStreamHandler.
|
* URLStreamHandler.
|
||||||
*
|
*
|
||||||
* @author Aaron M. Renn (arenn@urbanophile.com)
|
* @author Aaron M. Renn <arenn@urbanophile.com>
|
||||||
* @author Warren Levy <warrenl@cygnus.com>
|
* @author Warren Levy <warrenl@cygnus.com>
|
||||||
*
|
*
|
||||||
* @see URLStreamHandler
|
* @see URLStreamHandler
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue