summaryrefslogtreecommitdiff
path: root/libjava/java/net
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-09 19:58:05 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-09 19:58:05 +0000
commit65bf3316cf384588453604be6b4f0ed3751a8b0f (patch)
tree996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/java/net
parent8fc56618a84446beccd45b80381cdfe0e94050df (diff)
downloadgcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/net')
-rw-r--r--libjava/java/net/Authenticator.h51
-rw-r--r--libjava/java/net/BindException.h33
-rw-r--r--libjava/java/net/ConnectException.h33
-rw-r--r--libjava/java/net/ContentHandler.h34
-rw-r--r--libjava/java/net/ContentHandlerFactory.h30
-rw-r--r--libjava/java/net/DatagramPacket.h60
-rw-r--r--libjava/java/net/DatagramSocket.h87
-rw-r--r--libjava/java/net/DatagramSocket.java939
-rw-r--r--libjava/java/net/DatagramSocketImpl.h60
-rw-r--r--libjava/java/net/DatagramSocketImplFactory.h30
-rw-r--r--libjava/java/net/FileNameMap.h29
-rw-r--r--libjava/java/net/HttpURLConnection.h101
-rw-r--r--libjava/java/net/Inet4Address.h52
-rw-r--r--libjava/java/net/Inet6Address.h66
-rw-r--r--libjava/java/net/InetAddress.h76
-rw-r--r--libjava/java/net/InetSocketAddress.h49
-rw-r--r--libjava/java/net/JarURLConnection.h56
-rw-r--r--libjava/java/net/MalformedURLException.h33
-rw-r--r--libjava/java/net/MimeTypeMapper.h39
-rw-r--r--libjava/java/net/MulticastSocket.h50
-rw-r--r--libjava/java/net/MulticastSocket.java519
-rw-r--r--libjava/java/net/NetPermission.h33
-rw-r--r--libjava/java/net/NetworkInterface.h50
-rw-r--r--libjava/java/net/NetworkInterface.java299
-rw-r--r--libjava/java/net/NoRouteToHostException.h33
-rw-r--r--libjava/java/net/PasswordAuthentication.h37
-rw-r--r--libjava/java/net/PortUnreachableException.h33
-rw-r--r--libjava/java/net/ProtocolException.h33
-rw-r--r--libjava/java/net/Proxy$Type.h40
-rw-r--r--libjava/java/net/Proxy.h41
-rw-r--r--libjava/java/net/ProxySelector.h38
-rw-r--r--libjava/java/net/ResolverCache$Entry.h32
-rw-r--r--libjava/java/net/ResolverCache.h51
-rw-r--r--libjava/java/net/ServerSocket.h75
-rw-r--r--libjava/java/net/Socket.h103
-rw-r--r--libjava/java/net/Socket.java1269
-rw-r--r--libjava/java/net/SocketAddress.h32
-rw-r--r--libjava/java/net/SocketException.h33
-rw-r--r--libjava/java/net/SocketImpl.h63
-rw-r--r--libjava/java/net/SocketImplFactory.h30
-rw-r--r--libjava/java/net/SocketOptions.h44
-rw-r--r--libjava/java/net/SocketPermission.h68
-rw-r--r--libjava/java/net/SocketTimeoutException.h33
-rw-r--r--libjava/java/net/URI.h134
-rw-r--r--libjava/java/net/URISyntaxException.h39
-rw-r--r--libjava/java/net/URL$1.h31
-rw-r--r--libjava/java/net/URL.h89
-rw-r--r--libjava/java/net/URLClassLoader$1.h45
-rw-r--r--libjava/java/net/URLClassLoader$2.h35
-rw-r--r--libjava/java/net/URLClassLoader$CoreResource.h46
-rw-r--r--libjava/java/net/URLClassLoader$CoreURLLoader.h36
-rw-r--r--libjava/java/net/URLClassLoader$FileResource.h38
-rw-r--r--libjava/java/net/URLClassLoader$FileURLLoader.h35
-rw-r--r--libjava/java/net/URLClassLoader$JarURLLoader.h40
-rw-r--r--libjava/java/net/URLClassLoader$JarURLResource.h48
-rw-r--r--libjava/java/net/URLClassLoader$RemoteResource.h40
-rw-r--r--libjava/java/net/URLClassLoader$RemoteURLLoader.h36
-rw-r--r--libjava/java/net/URLClassLoader$Resource.h48
-rw-r--r--libjava/java/net/URLClassLoader$SoResource.h38
-rw-r--r--libjava/java/net/URLClassLoader$SoURLLoader.h47
-rw-r--r--libjava/java/net/URLClassLoader$URLLoader.h45
-rw-r--r--libjava/java/net/URLClassLoader.h82
-rw-r--r--libjava/java/net/URLClassLoader.java12
-rw-r--r--libjava/java/net/URLConnection.h117
-rw-r--r--libjava/java/net/URLDecoder.h31
-rw-r--r--libjava/java/net/URLEncoder.h35
-rw-r--r--libjava/java/net/URLStreamHandler.h48
-rw-r--r--libjava/java/net/URLStreamHandlerFactory.h30
-rw-r--r--libjava/java/net/UnknownHostException.h33
-rw-r--r--libjava/java/net/UnknownServiceException.h33
-rw-r--r--libjava/java/net/VMInetAddress.h37
-rw-r--r--libjava/java/net/VMNetworkInterface.h31
-rw-r--r--libjava/java/net/VMURLConnection.h38
-rw-r--r--libjava/java/net/VMURLConnection.java13
-rw-r--r--libjava/java/net/natURLClassLoader.cc22
-rw-r--r--libjava/java/net/natVMURLConnection.cc56
76 files changed, 6350 insertions, 35 deletions
diff --git a/libjava/java/net/Authenticator.h b/libjava/java/net/Authenticator.h
new file mode 100644
index 00000000000..b8e26606bea
--- /dev/null
+++ b/libjava/java/net/Authenticator.h
@@ -0,0 +1,51 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Authenticator__
+#define __java_net_Authenticator__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class Authenticator;
+ class InetAddress;
+ class PasswordAuthentication;
+ }
+ }
+}
+
+class java::net::Authenticator : public ::java::lang::Object
+{
+
+public:
+ static void setDefault(::java::net::Authenticator *);
+ static ::java::net::PasswordAuthentication * requestPasswordAuthentication(::java::net::InetAddress *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ static ::java::net::PasswordAuthentication * requestPasswordAuthentication(::java::lang::String *, ::java::net::InetAddress *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ Authenticator();
+public: // actually protected
+ virtual ::java::net::InetAddress * getRequestingSite();
+ virtual ::java::lang::String * getRequestingHost();
+ virtual jint getRequestingPort();
+ virtual ::java::lang::String * getRequestingProtocol();
+ virtual ::java::lang::String * getRequestingPrompt();
+ virtual ::java::lang::String * getRequestingScheme();
+ virtual ::java::net::PasswordAuthentication * getPasswordAuthentication();
+private:
+ static ::java::net::Authenticator * defaultAuthenticator;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) host;
+ ::java::net::InetAddress * addr;
+ jint port;
+ ::java::lang::String * protocol;
+ ::java::lang::String * prompt;
+ ::java::lang::String * scheme;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Authenticator__
diff --git a/libjava/java/net/BindException.h b/libjava/java/net/BindException.h
new file mode 100644
index 00000000000..6056f55f744
--- /dev/null
+++ b/libjava/java/net/BindException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_BindException__
+#define __java_net_BindException__
+
+#pragma interface
+
+#include <java/net/SocketException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class BindException;
+ }
+ }
+}
+
+class java::net::BindException : public ::java::net::SocketException
+{
+
+public:
+ BindException();
+ BindException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -5945005768251722951LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_BindException__
diff --git a/libjava/java/net/ConnectException.h b/libjava/java/net/ConnectException.h
new file mode 100644
index 00000000000..324ff1fe7c7
--- /dev/null
+++ b/libjava/java/net/ConnectException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ConnectException__
+#define __java_net_ConnectException__
+
+#pragma interface
+
+#include <java/net/SocketException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ConnectException;
+ }
+ }
+}
+
+class java::net::ConnectException : public ::java::net::SocketException
+{
+
+public:
+ ConnectException();
+ ConnectException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 3831404271622369215LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ConnectException__
diff --git a/libjava/java/net/ContentHandler.h b/libjava/java/net/ContentHandler.h
new file mode 100644
index 00000000000..62aecff06a0
--- /dev/null
+++ b/libjava/java/net/ContentHandler.h
@@ -0,0 +1,34 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ContentHandler__
+#define __java_net_ContentHandler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ContentHandler;
+ class URLConnection;
+ }
+ }
+}
+
+class java::net::ContentHandler : public ::java::lang::Object
+{
+
+public:
+ ContentHandler();
+ virtual ::java::lang::Object * getContent(::java::net::URLConnection *) = 0;
+ virtual ::java::lang::Object * getContent(::java::net::URLConnection *, JArray< ::java::lang::Class * > *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ContentHandler__
diff --git a/libjava/java/net/ContentHandlerFactory.h b/libjava/java/net/ContentHandlerFactory.h
new file mode 100644
index 00000000000..ca153310473
--- /dev/null
+++ b/libjava/java/net/ContentHandlerFactory.h
@@ -0,0 +1,30 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ContentHandlerFactory__
+#define __java_net_ContentHandlerFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ContentHandler;
+ class ContentHandlerFactory;
+ }
+ }
+}
+
+class java::net::ContentHandlerFactory : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::net::ContentHandler * createContentHandler(::java::lang::String *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_ContentHandlerFactory__
diff --git a/libjava/java/net/DatagramPacket.h b/libjava/java/net/DatagramPacket.h
new file mode 100644
index 00000000000..068329e05c5
--- /dev/null
+++ b/libjava/java/net/DatagramPacket.h
@@ -0,0 +1,60 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_DatagramPacket__
+#define __java_net_DatagramPacket__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class DatagramPacket;
+ class InetAddress;
+ class SocketAddress;
+ }
+ }
+}
+
+class java::net::DatagramPacket : public ::java::lang::Object
+{
+
+public:
+ DatagramPacket(JArray< jbyte > *, jint, jint);
+ DatagramPacket(JArray< jbyte > *, jint);
+ DatagramPacket(JArray< jbyte > *, jint, jint, ::java::net::InetAddress *, jint);
+ DatagramPacket(JArray< jbyte > *, jint, ::java::net::InetAddress *, jint);
+ DatagramPacket(JArray< jbyte > *, jint, jint, ::java::net::SocketAddress *);
+ DatagramPacket(JArray< jbyte > *, jint, ::java::net::SocketAddress *);
+ ::java::net::InetAddress * getAddress();
+ jint getPort();
+ JArray< jbyte > * getData();
+ jint getOffset();
+ jint getLength();
+ void setAddress(::java::net::InetAddress *);
+ void setPort(jint);
+ void setSocketAddress(::java::net::SocketAddress *);
+ ::java::net::SocketAddress * getSocketAddress();
+ void setData(JArray< jbyte > *);
+ void setData(JArray< jbyte > *, jint, jint);
+ void setLength(jint);
+private:
+ JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) buffer;
+ jint offset;
+public: // actually package-private
+ jint length;
+ jint maxlen;
+private:
+ ::java::net::InetAddress * address;
+ jint port;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_DatagramPacket__
diff --git a/libjava/java/net/DatagramSocket.h b/libjava/java/net/DatagramSocket.h
new file mode 100644
index 00000000000..a1761e11549
--- /dev/null
+++ b/libjava/java/net/DatagramSocket.h
@@ -0,0 +1,87 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_DatagramSocket__
+#define __java_net_DatagramSocket__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class DatagramPacket;
+ class DatagramSocket;
+ class DatagramSocketImpl;
+ class DatagramSocketImplFactory;
+ class InetAddress;
+ class SocketAddress;
+ }
+ namespace nio
+ {
+ namespace channels
+ {
+ class DatagramChannel;
+ }
+ }
+ }
+}
+
+class java::net::DatagramSocket : public ::java::lang::Object
+{
+
+public: // actually protected
+ DatagramSocket(::java::net::DatagramSocketImpl *);
+public:
+ DatagramSocket();
+ DatagramSocket(jint);
+ DatagramSocket(jint, ::java::net::InetAddress *);
+ DatagramSocket(::java::net::SocketAddress *);
+public: // actually package-private
+ virtual ::java::net::DatagramSocketImpl * getImpl();
+public:
+ virtual void close();
+ virtual ::java::net::InetAddress * getInetAddress();
+ virtual jint getPort();
+ virtual ::java::net::InetAddress * getLocalAddress();
+ virtual jint getLocalPort();
+ virtual jint getSoTimeout();
+ virtual void setSoTimeout(jint);
+ virtual jint getSendBufferSize();
+ virtual void setSendBufferSize(jint);
+ virtual jint getReceiveBufferSize();
+ virtual void setReceiveBufferSize(jint);
+ virtual void connect(::java::net::InetAddress *, jint);
+ virtual void disconnect();
+ virtual void receive(::java::net::DatagramPacket *);
+ virtual void send(::java::net::DatagramPacket *);
+ virtual void bind(::java::net::SocketAddress *);
+ virtual jboolean isClosed();
+ virtual ::java::nio::channels::DatagramChannel * getChannel();
+ virtual void connect(::java::net::SocketAddress *);
+ virtual jboolean isBound();
+ virtual jboolean isConnected();
+ virtual ::java::net::SocketAddress * getRemoteSocketAddress();
+ virtual ::java::net::SocketAddress * getLocalSocketAddress();
+ virtual void setReuseAddress(jboolean);
+ virtual jboolean getReuseAddress();
+ virtual void setBroadcast(jboolean);
+ virtual jboolean getBroadcast();
+ virtual void setTrafficClass(jint);
+ virtual jint getTrafficClass();
+ static void setDatagramSocketImplFactory(::java::net::DatagramSocketImplFactory *);
+private:
+ static ::java::net::DatagramSocketImplFactory * factory;
+ ::java::net::DatagramSocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
+ jboolean implCreated;
+ ::java::net::InetAddress * remoteAddress;
+ jint remotePort;
+ jboolean bound;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_DatagramSocket__
diff --git a/libjava/java/net/DatagramSocket.java b/libjava/java/net/DatagramSocket.java
new file mode 100644
index 00000000000..d8837c006b5
--- /dev/null
+++ b/libjava/java/net/DatagramSocket.java
@@ -0,0 +1,939 @@
+/* DatagramSocket.java -- A class to model UDP sockets
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+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.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. */
+
+package java.net;
+
+import gnu.classpath.SystemProperties;
+
+import gnu.java.net.PlainDatagramSocketImpl;
+import gnu.java.nio.DatagramChannelImpl;
+
+import java.io.IOException;
+import java.nio.channels.DatagramChannel;
+import java.nio.channels.IllegalBlockingModeException;
+
+
+/**
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ */
+/**
+ * This class models a connectionless datagram socket that sends
+ * individual packets of data across the network. In the TCP/IP world,
+ * this means UDP. Datagram packets do not have guaranteed delivery,
+ * or any guarantee about the order the data will be received on the
+ * remote host.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @date May 3, 1999.
+ */
+public class DatagramSocket
+{
+ /**
+ * This is the user DatagramSocketImplFactory for this class. If this
+ * variable is null, a default factory is used.
+ */
+ private static DatagramSocketImplFactory factory;
+
+ /**
+ * This is the implementation object used by this socket.
+ */
+ private DatagramSocketImpl impl;
+
+ /**
+ * True if socket implementation was created.
+ */
+ private boolean implCreated;
+
+ /**
+ * This is the address we are "connected" to
+ */
+ private InetAddress remoteAddress;
+
+ /**
+ * This is the port we are "connected" to
+ */
+ private int remotePort = -1;
+
+ /**
+ * True if socket is bound.
+ */
+ private boolean bound;
+
+ /**
+ * Creates a <code>DatagramSocket</code> from a specified
+ * <code>DatagramSocketImpl</code> instance
+ *
+ * @param impl The <code>DatagramSocketImpl</code> the socket will be
+ * created from
+ *
+ * @since 1.4
+ */
+ protected DatagramSocket(DatagramSocketImpl impl)
+ {
+ if (impl == null)
+ throw new NullPointerException("impl may not be null");
+
+ this.impl = impl;
+ this.remoteAddress = null;
+ this.remotePort = -1;
+ }
+
+ /**
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * a random port and every address on the local machine.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception SecurityException If a security manager exists and
+ * its <code>checkListen</code> method doesn't allow the operation.
+ */
+ public DatagramSocket() throws SocketException
+ {
+ this(new InetSocketAddress(0));
+ }
+
+ /**
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified port and every address on the local machine.
+ *
+ * @param port The local port number to bind to.
+ *
+ * @exception SecurityException If a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
+ */
+ public DatagramSocket(int port) throws SocketException
+ {
+ this(new InetSocketAddress(port));
+ }
+
+ /**
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified local port and address.
+ *
+ * @param port The local port number to bind to.
+ * @param addr The local address to bind to.
+ *
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
+ */
+ public DatagramSocket(int port, InetAddress addr) throws SocketException
+ {
+ this(new InetSocketAddress(addr, port));
+ }
+
+ /**
+ * Initializes a new instance of <code>DatagramSocket</code> that binds to
+ * the specified local port and address.
+ *
+ * @param address The local address and port number to bind to.
+ *
+ * @exception SecurityException If a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.4
+ */
+ public DatagramSocket(SocketAddress address) throws SocketException
+ {
+ String propVal = SystemProperties.getProperty("impl.prefix");
+ if (propVal == null || propVal.equals(""))
+ {
+ if (factory != null)
+ impl = factory.createDatagramSocketImpl();
+ else
+ impl = new PlainDatagramSocketImpl();
+ }
+ else
+ try
+ {
+ impl =
+ (DatagramSocketImpl) Class.forName("java.net." + propVal
+ + "DatagramSocketImpl")
+ .newInstance();
+ }
+ catch (Exception e)
+ {
+ System.err.println("Could not instantiate class: java.net."
+ + propVal + "DatagramSocketImpl");
+ impl = new PlainDatagramSocketImpl();
+ }
+
+ if (address != null)
+ bind(address);
+ }
+
+ // This needs to be accessible from java.net.MulticastSocket
+ DatagramSocketImpl getImpl() throws SocketException
+ {
+ try
+ {
+ if (! implCreated)
+ {
+ impl.create();
+ implCreated = true;
+ }
+
+ return impl;
+ }
+ catch (IOException e)
+ {
+ SocketException se = new SocketException();
+ se.initCause(e);
+ throw se;
+ }
+ }
+
+ /**
+ * Closes this datagram socket.
+ */
+ public void close()
+ {
+ if (isClosed())
+ return;
+
+ try
+ {
+ getImpl().close();
+ }
+ catch (SocketException e)
+ {
+ // Ignore this case, just close the socket in finally clause.
+ }
+ finally
+ {
+ remoteAddress = null;
+ remotePort = -1;
+ impl = null;
+ }
+
+ try
+ {
+ if (getChannel() != null)
+ getChannel().close();
+ }
+ catch (IOException e)
+ {
+ // Do nothing.
+ }
+ }
+
+ /**
+ * This method returns the remote address to which this socket is
+ * connected. If this socket is not connected, then this method will
+ * return <code>null</code>.
+ *
+ * @return The remote address.
+ *
+ * @since 1.2
+ */
+ public InetAddress getInetAddress()
+ {
+ return remoteAddress;
+ }
+
+ /**
+ * This method returns the remote port to which this socket is
+ * connected. If this socket is not connected, then this method will
+ * return -1.
+ *
+ * @return The remote port.
+ *
+ * @since 1.2
+ */
+ public int getPort()
+ {
+ return remotePort;
+ }
+
+ /**
+ * Returns the local address this datagram socket is bound to.
+ *
+ * @return The local address is the socket is bound or null
+ *
+ * @since 1.1
+ */
+ public InetAddress getLocalAddress()
+ {
+ if (! isBound())
+ return null;
+
+ InetAddress localAddr;
+
+ try
+ {
+ localAddr =
+ (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkConnect(localAddr.getHostName(), -1);
+ }
+ catch (SecurityException e)
+ {
+ localAddr = InetAddress.ANY_IF;
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are bound.
+ return null;
+ }
+
+ return localAddr;
+ }
+
+ /**
+ * Returns the local port this socket is bound to.
+ *
+ * @return The local port number.
+ */
+ public int getLocalPort()
+ {
+ if (isClosed())
+ return -1;
+
+ try
+ {
+ return getImpl().getLocalPort();
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are bound.
+ return 0;
+ }
+ }
+
+ /**
+ * Returns the value of the socket's SO_TIMEOUT setting. If this method
+ * returns 0 then SO_TIMEOUT is disabled.
+ *
+ * @return The current timeout in milliseconds.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.1
+ */
+ public synchronized int getSoTimeout() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_TIMEOUT);
+
+ if (buf instanceof Integer)
+ return ((Integer) buf).intValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * Sets the value of the socket's SO_TIMEOUT value. A value of 0 will
+ * disable SO_TIMEOUT. Any other value is the number of milliseconds
+ * a socket read/write will block before timing out.
+ *
+ * @param timeout The new SO_TIMEOUT value in milliseconds.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.1
+ */
+ public synchronized void setSoTimeout(int timeout) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (timeout < 0)
+ throw new IllegalArgumentException("Invalid timeout: " + timeout);
+
+ getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ }
+
+ /**
+ * This method returns the value of the system level socket option
+ * SO_SNDBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ * @return The send buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.2
+ */
+ public int getSendBufferSize() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_SNDBUF);
+
+ if (buf instanceof Integer)
+ return ((Integer) buf).intValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_SNDBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
+ *
+ * @param size The new send buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If size is 0 or negative.
+ *
+ * @since 1.2
+ */
+ public void setSendBufferSize(int size) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (size < 0)
+ throw new IllegalArgumentException("Buffer size is less than 0");
+
+ getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ }
+
+ /**
+ * This method returns the value of the system level socket option
+ * SO_RCVBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ * @return The receive buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.2
+ */
+ public int getReceiveBufferSize() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_RCVBUF);
+
+ if (buf instanceof Integer)
+ return ((Integer) buf).intValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_RCVBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
+ *
+ * @param size The new receive buffer size.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If size is 0 or negative.
+ *
+ * @since 1.2
+ */
+ public void setReceiveBufferSize(int size) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (size < 0)
+ throw new IllegalArgumentException("Buffer size is less than 0");
+
+ getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ }
+
+ /**
+ * This method connects this socket to the specified address and port.
+ * When a datagram socket is connected, it will only send or receive
+ * packets to and from the host to which it is connected. A multicast
+ * socket that is connected may only send and not receive packets.
+ *
+ * @param address The address to connect this socket to.
+ * @param port The port to connect this socket to.
+ *
+ * @exception IllegalArgumentException If address or port are invalid.
+ * @exception SecurityException If the caller is not allowed to send
+ * datagrams to or receive from this address and port.
+ *
+ * @since 1.2
+ */
+ public void connect(InetAddress address, int port)
+ {
+ if (address == null)
+ throw new IllegalArgumentException("Connect address may not be null");
+
+ if ((port < 1) || (port > 65535))
+ throw new IllegalArgumentException("Port number is illegal: " + port);
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect(address.getHostName(), port);
+
+ try
+ {
+ getImpl().connect(address, port);
+ remoteAddress = address;
+ remotePort = port;
+ }
+ catch (SocketException e)
+ {
+ // This means simply not connected or connect not implemented.
+ }
+ }
+
+ /**
+ * This method disconnects this socket from the address/port it was
+ * connected to. If the socket was not connected in the first place,
+ * this method does nothing.
+ *
+ * @since 1.2
+ */
+ public void disconnect()
+ {
+ if (! isConnected())
+ return;
+
+ try
+ {
+ getImpl().disconnect();
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are connected.
+ }
+ finally
+ {
+ remoteAddress = null;
+ remotePort = -1;
+ }
+ }
+
+ /**
+ * Reads a datagram packet from the socket. Note that this method
+ * will block until a packet is received from the network. On return,
+ * the passed in <code>DatagramPacket</code> is populated with the data
+ * received and all the other information about the packet.
+ *
+ * @param p A <code>DatagramPacket</code> for storing the data
+ *
+ * @exception IOException If an error occurs.
+ * @exception SocketTimeoutException If setSoTimeout was previously called
+ * and the timeout has expired.
+ * @exception PortUnreachableException If the socket is connected to a
+ * currently unreachable destination. Note, there is no guarantee that the
+ * exception will be thrown.
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode.
+ * @exception SecurityException If a security manager exists and its
+ * checkAccept method doesn't allow the receive.
+ */
+ public synchronized void receive(DatagramPacket p) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (remoteAddress != null && remoteAddress.isMulticastAddress())
+ throw new IOException
+ ("Socket connected to a multicast address my not receive");
+
+ if (getChannel() != null && ! getChannel().isBlocking()
+ && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation())
+ throw new IllegalBlockingModeException();
+
+ getImpl().receive(p);
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null && isConnected())
+ s.checkAccept(p.getAddress().getHostName(), p.getPort());
+ }
+
+ /**
+ * Sends the specified packet. The host and port to which the packet
+ * are to be sent should be set inside the packet.
+ *
+ * @param p The datagram packet to send.
+ *
+ * @exception IOException If an error occurs.
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast or checkConnect method doesn't allow the send.
+ * @exception PortUnreachableException If the socket is connected to a
+ * currently unreachable destination. Note, there is no guarantee that the
+ * exception will be thrown.
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode.
+ */
+ public void send(DatagramPacket p) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ // JDK1.2: Don't do security checks if socket is connected; see jdk1.2 api.
+ SecurityManager s = System.getSecurityManager();
+ if (s != null && ! isConnected())
+ {
+ InetAddress addr = p.getAddress();
+ if (addr.isMulticastAddress())
+ s.checkMulticast(addr);
+ else
+ s.checkConnect(addr.getHostAddress(), p.getPort());
+ }
+
+ if (isConnected())
+ {
+ if (p.getAddress() != null
+ && (remoteAddress != p.getAddress() || remotePort != p.getPort()))
+ throw new IllegalArgumentException
+ ("DatagramPacket address does not match remote address");
+ }
+
+ // FIXME: if this is a subclass of MulticastSocket,
+ // use getTimeToLive for TTL val.
+ if (getChannel() != null && ! getChannel().isBlocking()
+ && ! ((DatagramChannelImpl) getChannel()).isInChannelOperation())
+ throw new IllegalBlockingModeException();
+
+ getImpl().send(p);
+ }
+
+ /**
+ * Binds the socket to the given socket address.
+ *
+ * @param address The socket address to bind to.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception SecurityException If a security manager exists and
+ * its checkListen method doesn't allow the operation.
+ * @exception IllegalArgumentException If address type is not supported.
+ *
+ * @since 1.4
+ */
+ public void bind(SocketAddress address) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! (address instanceof InetSocketAddress))
+ throw new IllegalArgumentException("unsupported address type");
+
+ InetAddress addr = ((InetSocketAddress) address).getAddress();
+ int port = ((InetSocketAddress) address).getPort();
+
+ if (port < 0 || port > 65535)
+ throw new IllegalArgumentException("Invalid port: " + port);
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkListen(port);
+
+ if (addr == null)
+ addr = InetAddress.ANY_IF;
+
+ try
+ {
+ getImpl().bind(port, addr);
+ bound = true;
+ }
+ catch (SocketException exception)
+ {
+ getImpl().close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ getImpl().close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ getImpl().close();
+ throw error;
+ }
+ }
+
+ /**
+ * Checks if the datagram socket is closed.
+ *
+ * @return True if socket is closed, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isClosed()
+ {
+ return impl == null;
+ }
+
+ /**
+ * Returns the datagram channel assoziated with this datagram socket.
+ *
+ * @return The associated <code>DatagramChannel</code> object or null
+ *
+ * @since 1.4
+ */
+ public DatagramChannel getChannel()
+ {
+ return null;
+ }
+
+ /**
+ * Connects the datagram socket to a specified socket address.
+ *
+ * @param address The socket address to connect to.
+ *
+ * @exception SocketException If an error occurs.
+ * @exception IllegalArgumentException If address type is not supported.
+ *
+ * @since 1.4
+ */
+ public void connect(SocketAddress address) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! (address instanceof InetSocketAddress))
+ throw new IllegalArgumentException("unsupported address type");
+
+ InetSocketAddress tmp = (InetSocketAddress) address;
+ connect(tmp.getAddress(), tmp.getPort());
+ }
+
+ /**
+ * Returns the binding state of the socket.
+ *
+ * @return True if socket bound, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isBound()
+ {
+ return bound;
+ }
+
+ /**
+ * Returns the connection state of the socket.
+ *
+ * @return True if socket is connected, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isConnected()
+ {
+ return remoteAddress != null;
+ }
+
+ /**
+ * Returns the SocketAddress of the host this socket is conneted to
+ * or null if this socket is not connected.
+ *
+ * @return The socket address of the remote host if connected or null
+ *
+ * @since 1.4
+ */
+ public SocketAddress getRemoteSocketAddress()
+ {
+ if (! isConnected())
+ return null;
+
+ return new InetSocketAddress(remoteAddress, remotePort);
+ }
+
+ /**
+ * Returns the local SocketAddress this socket is bound to.
+ *
+ * @return The local SocketAddress or null if the socket is not bound.
+ *
+ * @since 1.4
+ */
+ public SocketAddress getLocalSocketAddress()
+ {
+ if (! isBound())
+ return null;
+
+ return new InetSocketAddress(getLocalAddress(), getLocalPort());
+ }
+
+ /**
+ * Enables/Disables SO_REUSEADDR.
+ *
+ * @param on Whether or not to have SO_REUSEADDR turned on.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.4
+ */
+ public void setReuseAddress(boolean on) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on));
+ }
+
+ /**
+ * Checks if SO_REUSEADDR is enabled.
+ *
+ * @return True if SO_REUSEADDR is set on the socket, false otherwise.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.4
+ */
+ public boolean getReuseAddress() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_REUSEADDR);
+
+ if (buf instanceof Boolean)
+ return ((Boolean) buf).booleanValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * Enables/Disables SO_BROADCAST
+ *
+ * @param enable True if SO_BROADCAST should be enabled, false otherwise.
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setBroadcast(boolean enable) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.SO_BROADCAST, Boolean.valueOf(enable));
+ }
+
+ /**
+ * Checks if SO_BROADCAST is enabled
+ *
+ * @return Whether SO_BROADCAST is set
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getBroadcast() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_BROADCAST);
+
+ if (buf instanceof Boolean)
+ return ((Boolean) buf).booleanValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * Sets the traffic class value
+ *
+ * @param tc The traffic class
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If tc value is illegal
+ *
+ * @see DatagramSocket#getTrafficClass()
+ *
+ * @since 1.4
+ */
+ public void setTrafficClass(int tc) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (tc < 0 || tc > 255)
+ throw new IllegalArgumentException();
+
+ getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+ }
+
+ /**
+ * Returns the current traffic class
+ *
+ * @return The current traffic class.
+ *
+ * @see DatagramSocket#setTrafficClass(int tc)
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public int getTrafficClass() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.IP_TOS);
+
+ if (buf instanceof Integer)
+ return ((Integer) buf).intValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * Sets the datagram socket implementation factory for the application
+ *
+ * @param fac The factory to set
+ *
+ * @exception IOException If an error occurs
+ * @exception SocketException If the factory is already defined
+ * @exception SecurityException If a security manager exists and its
+ * checkSetFactory method doesn't allow the operation
+ */
+ public static void setDatagramSocketImplFactory(DatagramSocketImplFactory fac)
+ throws IOException
+ {
+ if (factory != null)
+ throw new SocketException("DatagramSocketImplFactory already defined");
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSetFactory();
+
+ factory = fac;
+ }
+}
diff --git a/libjava/java/net/DatagramSocketImpl.h b/libjava/java/net/DatagramSocketImpl.h
new file mode 100644
index 00000000000..e29991b4235
--- /dev/null
+++ b/libjava/java/net/DatagramSocketImpl.h
@@ -0,0 +1,60 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_DatagramSocketImpl__
+#define __java_net_DatagramSocketImpl__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class DatagramPacket;
+ class DatagramSocketImpl;
+ class InetAddress;
+ class NetworkInterface;
+ class SocketAddress;
+ }
+ }
+}
+
+class java::net::DatagramSocketImpl : public ::java::lang::Object
+{
+
+public:
+ DatagramSocketImpl();
+public: // actually protected
+ virtual void bind(jint, ::java::net::InetAddress *) = 0;
+ virtual void close() = 0;
+ virtual void create() = 0;
+ virtual jint peek(::java::net::InetAddress *) = 0;
+ virtual jint peekData(::java::net::DatagramPacket *) = 0;
+ virtual void send(::java::net::DatagramPacket *) = 0;
+ virtual void receive(::java::net::DatagramPacket *) = 0;
+ virtual void connect(::java::net::InetAddress *, jint);
+ virtual void disconnect();
+ virtual void setTTL(jbyte) = 0;
+ virtual jbyte getTTL() = 0;
+ virtual void setTimeToLive(jint) = 0;
+ virtual jint getTimeToLive() = 0;
+ virtual void join(::java::net::InetAddress *) = 0;
+ virtual void leave(::java::net::InetAddress *) = 0;
+ virtual void joinGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *) = 0;
+ virtual void leaveGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *) = 0;
+ virtual ::java::io::FileDescriptor * getFileDescriptor();
+ virtual jint getLocalPort();
+public:
+ virtual void setOption(jint, ::java::lang::Object *) = 0;
+ virtual ::java::lang::Object * getOption(jint) = 0;
+public: // actually protected
+ jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) localPort;
+ ::java::io::FileDescriptor * fd;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_DatagramSocketImpl__
diff --git a/libjava/java/net/DatagramSocketImplFactory.h b/libjava/java/net/DatagramSocketImplFactory.h
new file mode 100644
index 00000000000..15e1780ec89
--- /dev/null
+++ b/libjava/java/net/DatagramSocketImplFactory.h
@@ -0,0 +1,30 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_DatagramSocketImplFactory__
+#define __java_net_DatagramSocketImplFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class DatagramSocketImpl;
+ class DatagramSocketImplFactory;
+ }
+ }
+}
+
+class java::net::DatagramSocketImplFactory : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::net::DatagramSocketImpl * createDatagramSocketImpl() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_DatagramSocketImplFactory__
diff --git a/libjava/java/net/FileNameMap.h b/libjava/java/net/FileNameMap.h
new file mode 100644
index 00000000000..916f14023e9
--- /dev/null
+++ b/libjava/java/net/FileNameMap.h
@@ -0,0 +1,29 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_FileNameMap__
+#define __java_net_FileNameMap__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class FileNameMap;
+ }
+ }
+}
+
+class java::net::FileNameMap : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::lang::String * getContentTypeFor(::java::lang::String *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_FileNameMap__
diff --git a/libjava/java/net/HttpURLConnection.h b/libjava/java/net/HttpURLConnection.h
new file mode 100644
index 00000000000..d192e33ad6b
--- /dev/null
+++ b/libjava/java/net/HttpURLConnection.h
@@ -0,0 +1,101 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_HttpURLConnection__
+#define __java_net_HttpURLConnection__
+
+#pragma interface
+
+#include <java/net/URLConnection.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class HttpURLConnection;
+ class URL;
+ }
+ namespace security
+ {
+ class Permission;
+ }
+ }
+}
+
+class java::net::HttpURLConnection : public ::java::net::URLConnection
+{
+
+public: // actually protected
+ HttpURLConnection(::java::net::URL *);
+public:
+ virtual void disconnect() = 0;
+ virtual jboolean usingProxy() = 0;
+ static void setFollowRedirects(jboolean);
+ static jboolean getFollowRedirects();
+ virtual jboolean getInstanceFollowRedirects();
+ virtual void setInstanceFollowRedirects(jboolean);
+ virtual void setRequestMethod(::java::lang::String *);
+ virtual ::java::lang::String * getRequestMethod();
+ virtual jint getResponseCode();
+ virtual ::java::lang::String * getResponseMessage();
+private:
+ void getResponseVals();
+public:
+ virtual ::java::security::Permission * getPermission();
+ virtual ::java::io::InputStream * getErrorStream();
+ virtual jlong getHeaderFieldDate(::java::lang::String *, jlong);
+public: // actually package-private
+ static const jint HTTP_CONTINUE = 100;
+public:
+ static const jint HTTP_OK = 200;
+ static const jint HTTP_CREATED = 201;
+ static const jint HTTP_ACCEPTED = 202;
+ static const jint HTTP_NOT_AUTHORITATIVE = 203;
+ static const jint HTTP_NO_CONTENT = 204;
+ static const jint HTTP_RESET = 205;
+ static const jint HTTP_PARTIAL = 206;
+ static const jint HTTP_MULT_CHOICE = 300;
+ static const jint HTTP_MOVED_PERM = 301;
+ static const jint HTTP_MOVED_TEMP = 302;
+ static const jint HTTP_SEE_OTHER = 303;
+ static const jint HTTP_NOT_MODIFIED = 304;
+ static const jint HTTP_USE_PROXY = 305;
+ static const jint HTTP_BAD_REQUEST = 400;
+ static const jint HTTP_UNAUTHORIZED = 401;
+ static const jint HTTP_PAYMENT_REQUIRED = 402;
+ static const jint HTTP_FORBIDDEN = 403;
+ static const jint HTTP_NOT_FOUND = 404;
+ static const jint HTTP_BAD_METHOD = 405;
+ static const jint HTTP_NOT_ACCEPTABLE = 406;
+ static const jint HTTP_PROXY_AUTH = 407;
+ static const jint HTTP_CLIENT_TIMEOUT = 408;
+ static const jint HTTP_CONFLICT = 409;
+ static const jint HTTP_GONE = 410;
+ static const jint HTTP_LENGTH_REQUIRED = 411;
+ static const jint HTTP_PRECON_FAILED = 412;
+ static const jint HTTP_ENTITY_TOO_LARGE = 413;
+ static const jint HTTP_REQ_TOO_LONG = 414;
+ static const jint HTTP_UNSUPPORTED_TYPE = 415;
+ static const jint HTTP_SERVER_ERROR = 500;
+ static const jint HTTP_INTERNAL_ERROR = 500;
+ static const jint HTTP_NOT_IMPLEMENTED = 501;
+ static const jint HTTP_BAD_GATEWAY = 502;
+ static const jint HTTP_UNAVAILABLE = 503;
+ static const jint HTTP_GATEWAY_TIMEOUT = 504;
+ static const jint HTTP_VERSION = 505;
+private:
+ static jboolean followRedirects;
+ static ::java::lang::String * valid_methods;
+public: // actually protected
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLConnection)))) method;
+ jint responseCode;
+ ::java::lang::String * responseMessage;
+ jboolean instanceFollowRedirects;
+private:
+ jboolean gotResponseVals;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_HttpURLConnection__
diff --git a/libjava/java/net/Inet4Address.h b/libjava/java/net/Inet4Address.h
new file mode 100644
index 00000000000..5ff13154680
--- /dev/null
+++ b/libjava/java/net/Inet4Address.h
@@ -0,0 +1,52 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Inet4Address__
+#define __java_net_Inet4Address__
+
+#pragma interface
+
+#include <java/net/InetAddress.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class Inet4Address;
+ }
+ }
+}
+
+class java::net::Inet4Address : public ::java::net::InetAddress
+{
+
+ ::java::lang::Object * writeReplace();
+public: // actually package-private
+ Inet4Address(JArray< jbyte > *, ::java::lang::String *);
+public:
+ jboolean isMulticastAddress();
+ jboolean isLoopbackAddress();
+ jboolean isAnyLocalAddress();
+ jboolean isLinkLocalAddress();
+ jboolean isSiteLocalAddress();
+ jboolean isMCGlobal();
+ jboolean isMCNodeLocal();
+ jboolean isMCLinkLocal();
+ jboolean isMCSiteLocal();
+ jboolean isMCOrgLocal();
+ JArray< jbyte > * getAddress();
+ ::java::lang::String * getHostAddress();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+public: // actually package-private
+ static const jlong serialVersionUID = 3286316764910316507LL;
+private:
+ static const jint AF_INET = 2;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Inet4Address__
diff --git a/libjava/java/net/Inet6Address.h b/libjava/java/net/Inet6Address.h
new file mode 100644
index 00000000000..933a4780a18
--- /dev/null
+++ b/libjava/java/net/Inet6Address.h
@@ -0,0 +1,66 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Inet6Address__
+#define __java_net_Inet6Address__
+
+#pragma interface
+
+#include <java/net/InetAddress.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class Inet6Address;
+ class NetworkInterface;
+ }
+ }
+}
+
+class java::net::Inet6Address : public ::java::net::InetAddress
+{
+
+public: // actually package-private
+ Inet6Address(JArray< jbyte > *, ::java::lang::String *);
+public:
+ jboolean isMulticastAddress();
+ jboolean isAnyLocalAddress();
+ jboolean isLoopbackAddress();
+ jboolean isLinkLocalAddress();
+ jboolean isSiteLocalAddress();
+ jboolean isMCGlobal();
+ jboolean isMCNodeLocal();
+ jboolean isMCLinkLocal();
+ jboolean isMCSiteLocal();
+ jboolean isMCOrgLocal();
+ JArray< jbyte > * getAddress();
+ static ::java::net::Inet6Address * getByAddress(::java::lang::String *, JArray< jbyte > *, jint);
+ static ::java::net::Inet6Address * getByAddress(::java::lang::String *, JArray< jbyte > *, ::java::net::NetworkInterface *);
+ ::java::net::NetworkInterface * getScopedInterface();
+ jint getScopeId();
+ ::java::lang::String * getHostAddress();
+ jint hashCode();
+ jboolean equals(::java::lang::Object *);
+ jboolean isIPv4CompatibleAddress();
+private:
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+public: // actually package-private
+ static const jlong serialVersionUID = 6880410070516793377LL;
+ JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::net::InetAddress)))) ipaddress;
+private:
+ jint scope_id;
+ jboolean scope_id_set;
+ jboolean scope_ifname_set;
+ ::java::lang::String * ifname;
+ ::java::net::NetworkInterface * nif;
+ static const jint AF_INET6 = 10;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Inet6Address__
diff --git a/libjava/java/net/InetAddress.h b/libjava/java/net/InetAddress.h
new file mode 100644
index 00000000000..8cde4fb5daa
--- /dev/null
+++ b/libjava/java/net/InetAddress.h
@@ -0,0 +1,76 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_InetAddress__
+#define __java_net_InetAddress__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ }
+ }
+}
+
+class java::net::InetAddress : public ::java::lang::Object
+{
+
+public: // actually package-private
+ InetAddress(JArray< jbyte > *, ::java::lang::String *, jint);
+public:
+ virtual jboolean isMulticastAddress();
+ virtual jboolean isAnyLocalAddress();
+ virtual jboolean isLoopbackAddress();
+ virtual jboolean isLinkLocalAddress();
+ virtual jboolean isSiteLocalAddress();
+ virtual jboolean isMCGlobal();
+ virtual jboolean isMCNodeLocal();
+ virtual jboolean isMCLinkLocal();
+ virtual jboolean isMCSiteLocal();
+ virtual jboolean isMCOrgLocal();
+ virtual ::java::lang::String * getHostName();
+public: // actually package-private
+ virtual ::java::lang::String * internalGetCanonicalHostName();
+public:
+ virtual ::java::lang::String * getCanonicalHostName();
+ virtual JArray< jbyte > * getAddress();
+ virtual ::java::lang::String * getHostAddress();
+ virtual jint hashCode();
+ virtual jboolean equals(::java::lang::Object *);
+ virtual ::java::lang::String * toString();
+ static ::java::net::InetAddress * getByAddress(JArray< jbyte > *);
+ static ::java::net::InetAddress * getByAddress(::java::lang::String *, JArray< jbyte > *);
+public: // actually package-private
+ static ::java::net::InetAddress * getByLiteral(::java::lang::String *);
+public:
+ static ::java::net::InetAddress * getByName(::java::lang::String *);
+ static JArray< ::java::net::InetAddress * > * getAllByName(::java::lang::String *);
+ static ::java::net::InetAddress * getLocalHost();
+private:
+ ::java::lang::Object * readResolve();
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+ static const jlong serialVersionUID = 3286316764910316507LL;
+public: // actually package-private
+ static ::java::net::InetAddress * ANY_IF;
+ static ::java::net::InetAddress * LOCALHOST;
+private:
+ jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) address;
+public: // actually package-private
+ JArray< jbyte > * addr;
+ ::java::lang::String * hostName;
+private:
+ jint family;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_InetAddress__
diff --git a/libjava/java/net/InetSocketAddress.h b/libjava/java/net/InetSocketAddress.h
new file mode 100644
index 00000000000..b4f14d41c8d
--- /dev/null
+++ b/libjava/java/net/InetSocketAddress.h
@@ -0,0 +1,49 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_InetSocketAddress__
+#define __java_net_InetSocketAddress__
+
+#pragma interface
+
+#include <java/net/SocketAddress.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class InetSocketAddress;
+ }
+ }
+}
+
+class java::net::InetSocketAddress : public ::java::net::SocketAddress
+{
+
+public:
+ InetSocketAddress(::java::net::InetAddress *, jint);
+ InetSocketAddress(jint);
+ InetSocketAddress(::java::lang::String *, jint);
+private:
+ InetSocketAddress(::java::lang::String *, jint, jboolean);
+public:
+ static ::java::net::InetSocketAddress * createUnresolved(::java::lang::String *, jint);
+ virtual jboolean equals(::java::lang::Object *);
+ virtual ::java::net::InetAddress * getAddress();
+ virtual ::java::lang::String * getHostName();
+ virtual jint getPort();
+ virtual jint hashCode();
+ virtual jboolean isUnresolved();
+ virtual ::java::lang::String * toString();
+private:
+ static const jlong serialVersionUID = 5076001401234631237LL;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::SocketAddress)))) hostname;
+ ::java::net::InetAddress * addr;
+ jint port;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_InetSocketAddress__
diff --git a/libjava/java/net/JarURLConnection.h b/libjava/java/net/JarURLConnection.h
new file mode 100644
index 00000000000..6c89e6e4d18
--- /dev/null
+++ b/libjava/java/net/JarURLConnection.h
@@ -0,0 +1,56 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_JarURLConnection__
+#define __java_net_JarURLConnection__
+
+#pragma interface
+
+#include <java/net/URLConnection.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class JarURLConnection;
+ class URL;
+ class URLConnection;
+ }
+ namespace security
+ {
+ namespace cert
+ {
+ class Certificate;
+ }
+ }
+ }
+}
+
+class java::net::JarURLConnection : public ::java::net::URLConnection
+{
+
+public: // actually protected
+ JarURLConnection(::java::net::URL *);
+public:
+ virtual ::java::net::URL * getJarFileURL();
+ virtual ::java::lang::String * getEntryName();
+ virtual ::java::util::jar::JarEntry * getJarEntry();
+ virtual ::java::util::jar::JarFile * getJarFile() = 0;
+ virtual JArray< ::java::security::cert::Certificate * > * getCertificates();
+ virtual ::java::util::jar::Attributes * getMainAttributes();
+ virtual ::java::util::jar::Attributes * getAttributes();
+ virtual ::java::util::jar::Manifest * getManifest();
+private:
+ ::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLConnection)))) jarFileURL;
+public: // actually protected
+ ::java::net::URLConnection * jarFileURLConnection;
+private:
+ ::java::lang::String * entryName;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_JarURLConnection__
diff --git a/libjava/java/net/MalformedURLException.h b/libjava/java/net/MalformedURLException.h
new file mode 100644
index 00000000000..713bf5e7d6f
--- /dev/null
+++ b/libjava/java/net/MalformedURLException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_MalformedURLException__
+#define __java_net_MalformedURLException__
+
+#pragma interface
+
+#include <java/io/IOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class MalformedURLException;
+ }
+ }
+}
+
+class java::net::MalformedURLException : public ::java::io::IOException
+{
+
+public:
+ MalformedURLException();
+ MalformedURLException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -182787522200415866LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_MalformedURLException__
diff --git a/libjava/java/net/MimeTypeMapper.h b/libjava/java/net/MimeTypeMapper.h
new file mode 100644
index 00000000000..06fb2679e6f
--- /dev/null
+++ b/libjava/java/net/MimeTypeMapper.h
@@ -0,0 +1,39 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_MimeTypeMapper__
+#define __java_net_MimeTypeMapper__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class MimeTypeMapper;
+ }
+ }
+}
+
+class java::net::MimeTypeMapper : public ::java::lang::Object
+{
+
+public:
+ MimeTypeMapper();
+ static void fillFromFile(::java::util::Map *, ::java::lang::String *);
+ virtual ::java::lang::String * getContentTypeFor(::java::lang::String *);
+ static void main(JArray< ::java::lang::String * > *);
+public: // actually protected
+ static JArray< JArray< ::java::lang::String * > * > * mime_strings;
+private:
+ ::java::util::Hashtable * __attribute__((aligned(__alignof__( ::java::lang::Object)))) mime_types;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_MimeTypeMapper__
diff --git a/libjava/java/net/MulticastSocket.h b/libjava/java/net/MulticastSocket.h
new file mode 100644
index 00000000000..2faac45e39f
--- /dev/null
+++ b/libjava/java/net/MulticastSocket.h
@@ -0,0 +1,50 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_MulticastSocket__
+#define __java_net_MulticastSocket__
+
+#pragma interface
+
+#include <java/net/DatagramSocket.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class DatagramPacket;
+ class InetAddress;
+ class MulticastSocket;
+ class NetworkInterface;
+ class SocketAddress;
+ }
+ }
+}
+
+class java::net::MulticastSocket : public ::java::net::DatagramSocket
+{
+
+public:
+ MulticastSocket();
+ MulticastSocket(jint);
+ MulticastSocket(::java::net::SocketAddress *);
+ virtual ::java::net::InetAddress * getInterface();
+ virtual jbyte getTTL();
+ virtual jint getTimeToLive();
+ virtual void setInterface(::java::net::InetAddress *);
+ virtual void setNetworkInterface(::java::net::NetworkInterface *);
+ virtual ::java::net::NetworkInterface * getNetworkInterface();
+ virtual void setLoopbackMode(jboolean);
+ virtual jboolean getLoopbackMode();
+ virtual void setTTL(jbyte);
+ virtual void setTimeToLive(jint);
+ virtual void joinGroup(::java::net::InetAddress *);
+ virtual void leaveGroup(::java::net::InetAddress *);
+ virtual void joinGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *);
+ virtual void leaveGroup(::java::net::SocketAddress *, ::java::net::NetworkInterface *);
+ virtual void send(::java::net::DatagramPacket *, jbyte);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_MulticastSocket__
diff --git a/libjava/java/net/MulticastSocket.java b/libjava/java/net/MulticastSocket.java
new file mode 100644
index 00000000000..e24b1947731
--- /dev/null
+++ b/libjava/java/net/MulticastSocket.java
@@ -0,0 +1,519 @@
+/* MulticastSocket.java -- Class for using multicast sockets
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+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.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. */
+
+package java.net;
+
+import java.io.IOException;
+import java.util.Enumeration;
+
+
+/**
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ */
+/**
+ * This class models a multicast UDP socket. A multicast address is a
+ * class D internet address (one whose most significant bits are 1110).
+ * A multicast group consists of a multicast address and a well known
+ * port number. All members of the group listening on that address and
+ * port will receive all the broadcasts to the group.
+ * <p>
+ * Please note that applets are not allowed to use multicast sockets
+ *
+ * Written using on-line Java Platform 1.2 API Specification, as well
+ * as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
+ * Status: Believed complete and correct.
+ *
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Aaron M. Renn (arenn@urbanophile.com) (Documentation comments)
+ * @since 1.1
+ * @date May 18, 1999.
+ */
+public class MulticastSocket extends DatagramSocket
+{
+ /**
+ * Create a MulticastSocket that this not bound to any address
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ */
+ public MulticastSocket() throws IOException
+ {
+ this(new InetSocketAddress(0));
+ }
+
+ /**
+ * Create a multicast socket bound to the specified port
+ *
+ * @param port The port to bind to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ */
+ public MulticastSocket(int port) throws IOException
+ {
+ this(new InetSocketAddress(port));
+ }
+
+ /**
+ * Create a multicast socket bound to the specified SocketAddress.
+ *
+ * @param address The SocketAddress the multicast socket will be bound to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkListen method doesn't allow the operation
+ *
+ * @since 1.4
+ */
+ public MulticastSocket(SocketAddress address) throws IOException
+ {
+ super((SocketAddress) null);
+ setReuseAddress(true);
+ if (address != null)
+ bind(address);
+ }
+
+ /**
+ * Returns the interface being used for multicast packets
+ *
+ * @return The multicast interface
+ *
+ * @exception SocketException If an error occurs
+ */
+ public InetAddress getInterface() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ return (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
+ }
+
+ /**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires". This method id
+ * deprecated. Use <code>getTimeToLive</code> instead.
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2 Replaced by getTimeToLive()
+ *
+ * @see MulticastSocket#getTimeToLive()
+ */
+ public byte getTTL() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ // Use getTTL here rather than getTimeToLive in case we're using an impl
+ // other than the default PlainDatagramSocketImpl and it doesn't have
+ // getTimeToLive yet.
+ return getImpl().getTTL();
+ }
+
+ /**
+ * Returns the current value of the "Time to Live" option. This is the
+ * number of hops a packet can make before it "expires".
+ *
+ * @return The TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.2
+ */
+ public int getTimeToLive() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ return getImpl().getTimeToLive();
+ }
+
+ /**
+ * Sets the interface to use for sending multicast packets.
+ *
+ * @param addr The new interface to use.
+ *
+ * @exception SocketException If an error occurs.
+ *
+ * @since 1.4
+ */
+ public void setInterface(InetAddress addr) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.IP_MULTICAST_IF, addr);
+ }
+
+ /**
+ * Sets the local network interface used to send multicast messages
+ *
+ * @param netIf The local network interface used to send multicast messages
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see MulticastSocket#getNetworkInterface()
+ *
+ * @since 1.4
+ */
+ public void setNetworkInterface(NetworkInterface netIf)
+ throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ InetAddress address;
+ if (netIf != null)
+ out:
+ {
+ Enumeration e = netIf.getInetAddresses();
+ if (getLocalAddress() instanceof Inet4Address)
+ {
+ // Search for a IPv4 address.
+ while (e.hasMoreElements())
+ {
+ address = (InetAddress) e.nextElement();
+ if (address instanceof Inet4Address)
+ break out;
+ }
+ throw new SocketException("interface " + netIf.getName() + " has no IPv6 address");
+ }
+ else if (getLocalAddress() instanceof Inet6Address)
+ {
+ // Search for a IPv6 address.
+ while (e.hasMoreElements())
+ {
+ address = (InetAddress) e.nextElement();
+ if (address instanceof Inet6Address)
+ break out;
+ }
+ throw new SocketException("interface " + netIf.getName() + " has no IPv6 address");
+ }
+ else
+ throw new SocketException("interface " + netIf.getName() + " has no suitable IP address");
+ }
+ else
+ address = InetAddress.ANY_IF;
+
+
+ getImpl().setOption(SocketOptions.IP_MULTICAST_IF, address);
+ }
+
+ /**
+ * Gets the local network interface which is used to send multicast messages
+ *
+ * @return The local network interface to send multicast messages
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
+ *
+ * @since 1.4
+ */
+ public NetworkInterface getNetworkInterface() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ InetAddress address =
+ (InetAddress) getImpl().getOption(SocketOptions.IP_MULTICAST_IF);
+
+ // FIXME: libgcj doesn't have createAnyInterface.
+// if (address.isAnyLocalAddress())
+// return NetworkInterface.createAnyInterface();
+
+ NetworkInterface netIf = NetworkInterface.getByInetAddress(address);
+
+ return netIf;
+ }
+
+ /**
+ * Disable/Enable local loopback of multicast packets. The option is used by
+ * the platform's networking code as a hint for setting whether multicast
+ * data will be looped back to the local socket.
+ *
+ * Because this option is a hint, applications that want to verify what
+ * loopback mode is set to should call #getLoopbackMode
+ *
+ * @param disable True to disable loopback mode
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setLoopbackMode(boolean disable) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.IP_MULTICAST_LOOP,
+ Boolean.valueOf(disable));
+ }
+
+ /**
+ * Checks if local loopback mode is enabled
+ *
+ * @return true if loopback mode is enabled, false otherwise
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getLoopbackMode() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.IP_MULTICAST_LOOP);
+
+ if (buf instanceof Boolean)
+ return ((Boolean) buf).booleanValue();
+
+ throw new SocketException("unexpected type");
+ }
+
+ /**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @deprecated 1.2 Replaced by <code>setTimeToLive</code>
+ *
+ * @see MulticastSocket#setTimeToLive(int ttl)
+ */
+ public void setTTL(byte ttl) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ // Use setTTL here rather than setTimeToLive in case we're using an impl
+ // other than the default PlainDatagramSocketImpl and it doesn't have
+ // setTimeToLive yet.
+ getImpl().setTTL(ttl);
+ }
+
+ /**
+ * Sets the "Time to Live" value for a socket. The value must be between
+ * 1 and 255.
+ *
+ * @param ttl The new TTL value
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.2
+ */
+ public void setTimeToLive(int ttl) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (ttl <= 0 || ttl > 255)
+ throw new IllegalArgumentException("Invalid ttl: " + ttl);
+
+ getImpl().setTimeToLive(ttl);
+ }
+
+ /**
+ * Joins the specified multicast group.
+ *
+ * @param mcastaddr The address of the group to join
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ */
+ public void joinGroup(InetAddress mcastaddr) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! mcastaddr.isMulticastAddress())
+ throw new IOException("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkMulticast(mcastaddr);
+
+ getImpl().join(mcastaddr);
+ }
+
+ /**
+ * Leaves the specified multicast group
+ *
+ * @param mcastaddr The address of the group to leave
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ */
+ public void leaveGroup(InetAddress mcastaddr) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! mcastaddr.isMulticastAddress())
+ throw new IOException("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkMulticast(mcastaddr);
+
+ getImpl().leave(mcastaddr);
+ }
+
+ /**
+ * Joins the specified mulitcast group on a specified interface.
+ *
+ * @param mcastaddr The multicast address to join
+ * @param netIf The local network interface to receive the multicast
+ * messages on or null to defer the interface set by #setInterface or
+ * #setNetworkInterface
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ *
+ * @see MulticastSocket#setInterface(InetAddress addr)
+ * @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
+ *
+ * @since 1.4
+ */
+ public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! (mcastaddr instanceof InetSocketAddress))
+ throw new IllegalArgumentException("SocketAddress type not supported");
+
+ InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+
+ if (! tmp.getAddress().isMulticastAddress())
+ throw new IOException("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkMulticast(tmp.getAddress());
+
+ getImpl().joinGroup(mcastaddr, netIf);
+ }
+
+ /**
+ * Leaves the specified mulitcast group on a specified interface.
+ *
+ * @param mcastaddr The multicast address to leave
+ * @param netIf The local networki interface or null to defer to the
+ * interface set by setInterface or setNetworkInterface
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If address type is not supported
+ * @exception SecurityException If a security manager exists and its
+ * checkMulticast method doesn't allow the operation
+ *
+ * @see MulticastSocket#setInterface(InetAddress addr)
+ * @see MulticastSocket#setNetworkInterface(NetworkInterface netIf)
+ *
+ * @since 1.4
+ */
+ public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf)
+ throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ InetSocketAddress tmp = (InetSocketAddress) mcastaddr;
+
+ if (! tmp.getAddress().isMulticastAddress())
+ throw new IOException("Not a Multicast address");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ s.checkMulticast(tmp.getAddress());
+
+ getImpl().leaveGroup(mcastaddr, netIf);
+ }
+
+ /**
+ * Sends a packet of data to a multicast address with a TTL that is
+ * different from the default TTL on this socket. The default TTL for
+ * the socket is not changed.
+ *
+ * @param packet The packet of data to send
+ * @param ttl The TTL for this packet
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect or checkMulticast method doesn't allow the operation
+ *
+ * @deprecated
+ */
+ public synchronized void send(DatagramPacket packet, byte ttl)
+ throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null)
+ {
+ InetAddress addr = packet.getAddress();
+ if (addr.isMulticastAddress())
+ s.checkPermission(new SocketPermission(addr.getHostName()
+ + packet.getPort(),
+ "accept,connect"));
+ else
+ s.checkConnect(addr.getHostAddress(), packet.getPort());
+ }
+
+ int oldttl = getImpl().getTimeToLive();
+ getImpl().setTimeToLive(((int) ttl) & 0xFF);
+ getImpl().send(packet);
+ getImpl().setTimeToLive(oldttl);
+ }
+}
diff --git a/libjava/java/net/NetPermission.h b/libjava/java/net/NetPermission.h
new file mode 100644
index 00000000000..a6c88555bc9
--- /dev/null
+++ b/libjava/java/net/NetPermission.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_NetPermission__
+#define __java_net_NetPermission__
+
+#pragma interface
+
+#include <java/security/BasicPermission.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class NetPermission;
+ }
+ }
+}
+
+class java::net::NetPermission : public ::java::security::BasicPermission
+{
+
+public:
+ NetPermission(::java::lang::String *);
+ NetPermission(::java::lang::String *, ::java::lang::String *);
+public: // actually package-private
+ static const jlong serialVersionUID = -8343910153355041693LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_NetPermission__
diff --git a/libjava/java/net/NetworkInterface.h b/libjava/java/net/NetworkInterface.h
new file mode 100644
index 00000000000..66898a2129f
--- /dev/null
+++ b/libjava/java/net/NetworkInterface.h
@@ -0,0 +1,50 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_NetworkInterface__
+#define __java_net_NetworkInterface__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class NetworkInterface;
+ }
+ }
+}
+
+class java::net::NetworkInterface : public ::java::lang::Object
+{
+
+public: // actually package-private
+ NetworkInterface(::java::lang::String *, ::java::net::InetAddress *);
+ NetworkInterface(::java::lang::String *, JArray< ::java::net::InetAddress * > *);
+public:
+ ::java::lang::String * getName();
+ ::java::util::Enumeration * getInetAddresses();
+ ::java::lang::String * getDisplayName();
+ static ::java::net::NetworkInterface * getByName(::java::lang::String *);
+ static ::java::net::NetworkInterface * getByInetAddress(::java::net::InetAddress *);
+private:
+ static ::java::util::Collection * condense(::java::util::Collection *);
+public:
+ static ::java::util::Enumeration * getNetworkInterfaces();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ ::java::lang::String * toString();
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name;
+ ::java::util::Vector * inetAddresses;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_NetworkInterface__
diff --git a/libjava/java/net/NetworkInterface.java b/libjava/java/net/NetworkInterface.java
new file mode 100644
index 00000000000..7ad62a71395
--- /dev/null
+++ b/libjava/java/net/NetworkInterface.java
@@ -0,0 +1,299 @@
+/* NetworkInterface.java --
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+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.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. */
+
+
+package java.net;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+
+/**
+ * This class models a network interface on the host computer. A network
+ * interface contains a name (typically associated with a specific
+ * hardware adapter) and a list of addresses that are bound to it.
+ * For example, an ethernet interface may be named "eth0" and have the
+ * address 192.168.1.101 assigned to it.
+ *
+ * @author Michael Koch (konqueror@gmx.de)
+ * @since 1.4
+ */
+public final class NetworkInterface
+{
+ private String name;
+ private Vector<InetAddress> inetAddresses;
+
+ NetworkInterface(String name, InetAddress address)
+ {
+ this.name = name;
+ this.inetAddresses = new Vector(1, 1);
+ this.inetAddresses.add(address);
+ }
+
+ NetworkInterface(String name, InetAddress[] addresses)
+ {
+ this.name = name;
+ this.inetAddresses = new Vector(addresses.length, 1);
+
+ for (int i = 0; i < addresses.length; i++)
+ this.inetAddresses.add(addresses[i]);
+ }
+
+ /**
+ * Returns the name of the network interface
+ *
+ * @return The name of the interface.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns all available addresses of the network interface
+ *
+ * If a @see SecurityManager is available all addresses are checked
+ * with @see SecurityManager::checkConnect() if they are available.
+ * Only <code>InetAddresses</code> are returned where the security manager
+ * doesn't throw an exception.
+ *
+ * @return An enumeration of all addresses.
+ */
+ public Enumeration<InetAddress> getInetAddresses()
+ {
+ SecurityManager s = System.getSecurityManager();
+
+ if (s == null)
+ return inetAddresses.elements();
+
+ Vector<InetAddress> tmpInetAddresses = new Vector<InetAddress>(1, 1);
+
+ for (Enumeration<InetAddress> addresses = inetAddresses.elements();
+ addresses.hasMoreElements();)
+ {
+ InetAddress addr = addresses.nextElement();
+ try
+ {
+ s.checkConnect(addr.getHostAddress(), 58000);
+ tmpInetAddresses.add(addr);
+ }
+ catch (SecurityException e)
+ {
+ // Ignore.
+ }
+ }
+
+ return tmpInetAddresses.elements();
+ }
+
+ /**
+ * Returns the display name of the interface
+ *
+ * @return The display name of the interface
+ */
+ public String getDisplayName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns an network interface by name
+ *
+ * @param name The name of the interface to return
+ *
+ * @return a <code>NetworkInterface</code> object representing the interface,
+ * or null if there is no interface with that name.
+ *
+ * @exception SocketException If an error occurs
+ * @exception NullPointerException If the specified name is null
+ */
+ public static NetworkInterface getByName(String name)
+ throws SocketException
+ {
+ for (Enumeration e = getNetworkInterfaces(); e.hasMoreElements();)
+ {
+ NetworkInterface tmp = (NetworkInterface) e.nextElement();
+
+ if (name.equals(tmp.getName()))
+ return tmp;
+ }
+
+ // No interface with the given name found.
+ return null;
+ }
+
+ /**
+ * Return a network interface by its address
+ *
+ * @param addr The address of the interface to return
+ *
+ * @return the interface, or <code>null</code> if none found
+ *
+ * @exception SocketException If an error occurs
+ * @exception NullPointerException If the specified addess is null
+ */
+ public static NetworkInterface getByInetAddress(InetAddress addr)
+ throws SocketException
+ {
+ for (Enumeration interfaces = getNetworkInterfaces();
+ interfaces.hasMoreElements();)
+ {
+ NetworkInterface tmp = (NetworkInterface) interfaces.nextElement();
+
+ for (Enumeration addresses = tmp.inetAddresses.elements();
+ addresses.hasMoreElements();)
+ {
+ if (addr.equals((InetAddress) addresses.nextElement()))
+ return tmp;
+ }
+ }
+
+ throw new SocketException("no network interface is bound to such an IP address");
+ }
+
+ static private Collection condense(Collection interfaces)
+ {
+ final Map condensed = new HashMap();
+
+ final Iterator interfs = interfaces.iterator();
+ while (interfs.hasNext()) {
+
+ final NetworkInterface face = (NetworkInterface) interfs.next();
+ final String name = face.getName();
+
+ if (condensed.containsKey(name))
+ {
+ final NetworkInterface conface = (NetworkInterface) condensed.get(name);
+ if (!conface.inetAddresses.containsAll(face.inetAddresses))
+ {
+ final Iterator faceAddresses = face.inetAddresses.iterator();
+ while (faceAddresses.hasNext())
+ {
+ final InetAddress faceAddress = (InetAddress) faceAddresses.next();
+ if (!conface.inetAddresses.contains(faceAddress))
+ {
+ conface.inetAddresses.add(faceAddress);
+ }
+ }
+ }
+ }
+ else
+ {
+ condensed.put(name, face);
+ }
+ }
+
+ return condensed.values();
+ }
+
+ /**
+ * Return an <code>Enumeration</code> of all available network interfaces
+ *
+ * @return all interfaces
+ *
+ * @exception SocketException If an error occurs
+ */
+ public static Enumeration<NetworkInterface> getNetworkInterfaces()
+ throws SocketException
+ {
+ Vector<NetworkInterface> networkInterfaces =
+ VMNetworkInterface.getInterfaces();
+
+ if (networkInterfaces.isEmpty())
+ return null;
+
+ Collection condensed = condense(networkInterfaces);
+
+ return Collections.enumeration(condensed);
+ }
+
+ /**
+ * Checks if the current instance is equal to obj
+ *
+ * @param obj The object to compare with
+ *
+ * @return <code>true</code> if equal, <code>false</code> otherwise
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof NetworkInterface))
+ return false;
+
+ NetworkInterface tmp = (NetworkInterface) obj;
+
+ return (name.equals(tmp.name) && inetAddresses.equals(tmp.inetAddresses));
+ }
+
+ /**
+ * Returns the hashcode of the current instance
+ *
+ * @return the hashcode
+ */
+ public int hashCode()
+ {
+ // FIXME: hash correctly
+ return name.hashCode() + inetAddresses.hashCode();
+ }
+
+ /**
+ * Returns a string representation of the interface
+ *
+ * @return the string
+ */
+ public String toString()
+ {
+ // FIXME: check if this is correct
+ String result;
+ String separator = System.getProperty("line.separator");
+
+ result =
+ "name: " + getDisplayName() + " (" + getName() + ") addresses:"
+ + separator;
+
+ for (Enumeration e = inetAddresses.elements(); e.hasMoreElements();)
+ {
+ InetAddress address = (InetAddress) e.nextElement();
+ result += address.toString() + ";" + separator;
+ }
+
+ return result;
+ }
+}
diff --git a/libjava/java/net/NoRouteToHostException.h b/libjava/java/net/NoRouteToHostException.h
new file mode 100644
index 00000000000..7a639eaa749
--- /dev/null
+++ b/libjava/java/net/NoRouteToHostException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_NoRouteToHostException__
+#define __java_net_NoRouteToHostException__
+
+#pragma interface
+
+#include <java/net/SocketException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class NoRouteToHostException;
+ }
+ }
+}
+
+class java::net::NoRouteToHostException : public ::java::net::SocketException
+{
+
+public:
+ NoRouteToHostException();
+ NoRouteToHostException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -1897550894873493790LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_NoRouteToHostException__
diff --git a/libjava/java/net/PasswordAuthentication.h b/libjava/java/net/PasswordAuthentication.h
new file mode 100644
index 00000000000..2567fd0e5fc
--- /dev/null
+++ b/libjava/java/net/PasswordAuthentication.h
@@ -0,0 +1,37 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_PasswordAuthentication__
+#define __java_net_PasswordAuthentication__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class PasswordAuthentication;
+ }
+ }
+}
+
+class java::net::PasswordAuthentication : public ::java::lang::Object
+{
+
+public:
+ PasswordAuthentication(::java::lang::String *, JArray< jchar > *);
+ ::java::lang::String * getUserName();
+ JArray< jchar > * getPassword();
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) username;
+ JArray< jchar > * password;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_PasswordAuthentication__
diff --git a/libjava/java/net/PortUnreachableException.h b/libjava/java/net/PortUnreachableException.h
new file mode 100644
index 00000000000..5e0fff24987
--- /dev/null
+++ b/libjava/java/net/PortUnreachableException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_PortUnreachableException__
+#define __java_net_PortUnreachableException__
+
+#pragma interface
+
+#include <java/net/SocketException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class PortUnreachableException;
+ }
+ }
+}
+
+class java::net::PortUnreachableException : public ::java::net::SocketException
+{
+
+public:
+ PortUnreachableException();
+ PortUnreachableException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = 8462541992376507323LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_PortUnreachableException__
diff --git a/libjava/java/net/ProtocolException.h b/libjava/java/net/ProtocolException.h
new file mode 100644
index 00000000000..39e7b7b1e41
--- /dev/null
+++ b/libjava/java/net/ProtocolException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ProtocolException__
+#define __java_net_ProtocolException__
+
+#pragma interface
+
+#include <java/io/IOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ProtocolException;
+ }
+ }
+}
+
+class java::net::ProtocolException : public ::java::io::IOException
+{
+
+public:
+ ProtocolException();
+ ProtocolException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -6098449442062388080LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ProtocolException__
diff --git a/libjava/java/net/Proxy$Type.h b/libjava/java/net/Proxy$Type.h
new file mode 100644
index 00000000000..288bd8c519a
--- /dev/null
+++ b/libjava/java/net/Proxy$Type.h
@@ -0,0 +1,40 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Proxy$Type__
+#define __java_net_Proxy$Type__
+
+#pragma interface
+
+#include <java/lang/Enum.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class Proxy$Type;
+ }
+ }
+}
+
+class java::net::Proxy$Type : public ::java::lang::Enum
+{
+
+ Proxy$Type(::java::lang::String *, jint);
+public:
+ static JArray< ::java::net::Proxy$Type * > * values();
+ static ::java::net::Proxy$Type * valueOf(::java::lang::String *);
+ static ::java::net::Proxy$Type * DIRECT;
+ static ::java::net::Proxy$Type * HTTP;
+ static ::java::net::Proxy$Type * SOCKS;
+private:
+ static const jlong serialVersionUID = -2231209257930100533LL;
+ static JArray< ::java::net::Proxy$Type * > * ENUM$VALUES;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Proxy$Type__
diff --git a/libjava/java/net/Proxy.h b/libjava/java/net/Proxy.h
new file mode 100644
index 00000000000..b6b44e3a62f
--- /dev/null
+++ b/libjava/java/net/Proxy.h
@@ -0,0 +1,41 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Proxy__
+#define __java_net_Proxy__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class Proxy;
+ class Proxy$Type;
+ class SocketAddress;
+ }
+ }
+}
+
+class java::net::Proxy : public ::java::lang::Object
+{
+
+public:
+ Proxy(::java::net::Proxy$Type *, ::java::net::SocketAddress *);
+ virtual ::java::net::SocketAddress * address();
+ virtual ::java::net::Proxy$Type * type();
+ virtual jboolean equals(::java::lang::Object *);
+ virtual jint hashCode();
+ virtual ::java::lang::String * toString();
+ static ::java::net::Proxy * NO_PROXY;
+private:
+ ::java::net::Proxy$Type * __attribute__((aligned(__alignof__( ::java::lang::Object)))) type__;
+ ::java::net::SocketAddress * address__;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Proxy__
diff --git a/libjava/java/net/ProxySelector.h b/libjava/java/net/ProxySelector.h
new file mode 100644
index 00000000000..62382ee58a5
--- /dev/null
+++ b/libjava/java/net/ProxySelector.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ProxySelector__
+#define __java_net_ProxySelector__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ProxySelector;
+ class SocketAddress;
+ class URI;
+ }
+ }
+}
+
+class java::net::ProxySelector : public ::java::lang::Object
+{
+
+public:
+ ProxySelector();
+ static ::java::net::ProxySelector * getDefault();
+ static void setDefault(::java::net::ProxySelector *);
+ virtual void connectFailed(::java::net::URI *, ::java::net::SocketAddress *, ::java::io::IOException *) = 0;
+ virtual ::java::util::List * select(::java::net::URI *) = 0;
+private:
+ static ::java::net::ProxySelector * defaultSelector;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ProxySelector__
diff --git a/libjava/java/net/ResolverCache$Entry.h b/libjava/java/net/ResolverCache$Entry.h
new file mode 100644
index 00000000000..22b5da83f97
--- /dev/null
+++ b/libjava/java/net/ResolverCache$Entry.h
@@ -0,0 +1,32 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ResolverCache$Entry__
+#define __java_net_ResolverCache$Entry__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ResolverCache$Entry;
+ }
+ }
+}
+
+class java::net::ResolverCache$Entry : public ::java::lang::Object
+{
+
+public:
+ ResolverCache$Entry(::java::lang::Object *, ::java::lang::Object *);
+ ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) key;
+ ::java::lang::Object * value;
+ jlong expires;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ResolverCache$Entry__
diff --git a/libjava/java/net/ResolverCache.h b/libjava/java/net/ResolverCache.h
new file mode 100644
index 00000000000..d274d235c05
--- /dev/null
+++ b/libjava/java/net/ResolverCache.h
@@ -0,0 +1,51 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ResolverCache__
+#define __java_net_ResolverCache__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ResolverCache;
+ class ResolverCache$Entry;
+ }
+ }
+}
+
+class java::net::ResolverCache : public ::java::lang::Object
+{
+
+public: // actually package-private
+ ResolverCache();
+private:
+ static jint getTTL(::java::lang::String *, jint);
+public:
+ static ::java::lang::String * getHostByAddr(JArray< jbyte > *);
+ static JArray< JArray< jbyte > * > * getHostByName(::java::lang::String *);
+private:
+ static ::java::lang::Object * makeHashableAddress(JArray< jbyte > *);
+ static ::java::net::ResolverCache$Entry * get(::java::lang::Object *);
+ static void put(::java::net::ResolverCache$Entry *);
+ static void reap();
+public: // actually package-private
+ static jint access$0();
+ static jint access$1();
+private:
+ static jint POSITIVE_TTL;
+ static jint NEGATIVE_TTL;
+ static ::java::util::HashMap * cache;
+ static ::java::util::LinkedList * killqueue;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ResolverCache__
diff --git a/libjava/java/net/ServerSocket.h b/libjava/java/net/ServerSocket.h
new file mode 100644
index 00000000000..af51cb6d864
--- /dev/null
+++ b/libjava/java/net/ServerSocket.h
@@ -0,0 +1,75 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_ServerSocket__
+#define __java_net_ServerSocket__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class InetSocketAddress;
+ class ServerSocket;
+ class Socket;
+ class SocketAddress;
+ class SocketImpl;
+ class SocketImplFactory;
+ }
+ namespace nio
+ {
+ namespace channels
+ {
+ class ServerSocketChannel;
+ }
+ }
+ }
+}
+
+class java::net::ServerSocket : public ::java::lang::Object
+{
+
+public: // actually package-private
+ ServerSocket(::java::net::SocketImpl *);
+ virtual ::java::net::SocketImpl * getImpl();
+public:
+ ServerSocket();
+ ServerSocket(jint);
+ ServerSocket(jint, jint);
+ ServerSocket(jint, jint, ::java::net::InetAddress *);
+ virtual void bind(::java::net::SocketAddress *);
+ virtual void bind(::java::net::SocketAddress *, jint);
+ virtual ::java::net::InetAddress * getInetAddress();
+ virtual jint getLocalPort();
+ virtual ::java::net::SocketAddress * getLocalSocketAddress();
+ virtual ::java::net::Socket * accept();
+public: // actually protected
+ virtual void implAccept(::java::net::Socket *);
+public:
+ virtual void close();
+ virtual ::java::nio::channels::ServerSocketChannel * getChannel();
+ virtual jboolean isBound();
+ virtual jboolean isClosed();
+ virtual void setSoTimeout(jint);
+ virtual jint getSoTimeout();
+ virtual void setReuseAddress(jboolean);
+ virtual jboolean getReuseAddress();
+ virtual void setReceiveBufferSize(jint);
+ virtual jint getReceiveBufferSize();
+ virtual ::java::lang::String * toString();
+ static void setSocketFactory(::java::net::SocketImplFactory *);
+private:
+ static ::java::net::SocketImplFactory * factory;
+ ::java::net::SocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
+ ::java::net::InetSocketAddress * local;
+ jint port;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_ServerSocket__
diff --git a/libjava/java/net/Socket.h b/libjava/java/net/Socket.h
new file mode 100644
index 00000000000..776d6fc473a
--- /dev/null
+++ b/libjava/java/net/Socket.h
@@ -0,0 +1,103 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_Socket__
+#define __java_net_Socket__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class Socket;
+ class SocketAddress;
+ class SocketImpl;
+ class SocketImplFactory;
+ }
+ namespace nio
+ {
+ namespace channels
+ {
+ class SocketChannel;
+ }
+ }
+ }
+}
+
+class java::net::Socket : public ::java::lang::Object
+{
+
+public:
+ Socket();
+public: // actually protected
+ Socket(::java::net::SocketImpl *);
+public:
+ Socket(::java::lang::String *, jint);
+ Socket(::java::net::InetAddress *, jint);
+ Socket(::java::lang::String *, jint, ::java::net::InetAddress *, jint);
+ Socket(::java::net::InetAddress *, jint, ::java::net::InetAddress *, jint);
+ Socket(::java::lang::String *, jint, jboolean);
+ Socket(::java::net::InetAddress *, jint, jboolean);
+private:
+ Socket(::java::net::InetAddress *, jint, ::java::net::InetAddress *, jint, jboolean);
+ ::java::net::SocketImpl * getImpl();
+public:
+ virtual void bind(::java::net::SocketAddress *);
+ virtual void connect(::java::net::SocketAddress *);
+ virtual void connect(::java::net::SocketAddress *, jint);
+ virtual ::java::net::InetAddress * getInetAddress();
+ virtual ::java::net::InetAddress * getLocalAddress();
+ virtual jint getPort();
+ virtual jint getLocalPort();
+ virtual ::java::net::SocketAddress * getLocalSocketAddress();
+ virtual ::java::net::SocketAddress * getRemoteSocketAddress();
+ virtual ::java::io::InputStream * getInputStream();
+ virtual ::java::io::OutputStream * getOutputStream();
+ virtual void setTcpNoDelay(jboolean);
+ virtual jboolean getTcpNoDelay();
+ virtual void setSoLinger(jboolean, jint);
+ virtual jint getSoLinger();
+ virtual void sendUrgentData(jint);
+ virtual void setOOBInline(jboolean);
+ virtual jboolean getOOBInline();
+ virtual void setSoTimeout(jint);
+ virtual jint getSoTimeout();
+ virtual void setSendBufferSize(jint);
+ virtual jint getSendBufferSize();
+ virtual void setReceiveBufferSize(jint);
+ virtual jint getReceiveBufferSize();
+ virtual void setKeepAlive(jboolean);
+ virtual jboolean getKeepAlive();
+ virtual void close();
+ virtual ::java::lang::String * toString();
+ static void setSocketImplFactory(::java::net::SocketImplFactory *);
+ virtual void shutdownInput();
+ virtual void shutdownOutput();
+ virtual ::java::nio::channels::SocketChannel * getChannel();
+ virtual jboolean getReuseAddress();
+ virtual void setReuseAddress(jboolean);
+ virtual jint getTrafficClass();
+ virtual void setTrafficClass(jint);
+ virtual jboolean isConnected();
+ virtual jboolean isBound();
+ virtual jboolean isClosed();
+ virtual jboolean isInputShutdown();
+ virtual jboolean isOutputShutdown();
+public: // actually package-private
+ static ::java::net::SocketImplFactory * factory;
+ ::java::net::SocketImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) impl;
+ jboolean implCreated;
+ jboolean bound;
+private:
+ jboolean inputShutdown;
+ jboolean outputShutdown;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_Socket__
diff --git a/libjava/java/net/Socket.java b/libjava/java/net/Socket.java
new file mode 100644
index 00000000000..b2249ffaa0d
--- /dev/null
+++ b/libjava/java/net/Socket.java
@@ -0,0 +1,1269 @@
+/* Socket.java -- Client socket implementation
+ Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+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.
+
+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., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 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. */
+
+package java.net;
+
+import gnu.java.net.PlainSocketImpl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.channels.IllegalBlockingModeException;
+import java.nio.channels.SocketChannel;
+
+
+/* Written using on-line Java Platform 1.2 API Specification.
+ * Status: I believe all methods are implemented.
+ */
+
+/**
+ * This class models a client site socket. A socket is a TCP/IP endpoint
+ * for network communications conceptually similar to a file handle.
+ * <p>
+ * This class does not actually do any work. Instead, it redirects all of
+ * its calls to a socket implementation object which implements the
+ * <code>SocketImpl</code> interface. The implementation class is
+ * instantiated by factory class that implements the
+ * <code>SocketImplFactory interface</code>. A default
+ * factory is provided, however the factory may be set by a call to
+ * the <code>setSocketImplFactory</code> method. Note that this may only be
+ * done once per virtual machine. If a subsequent attempt is made to set the
+ * factory, a <code>SocketException</code> will be thrown.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Per Bothner (bothner@cygnus.com)
+ */
+public class Socket
+{
+ /**
+ * This is the user SocketImplFactory for this class. If this variable is
+ * null, a default factory is used.
+ */
+ static SocketImplFactory factory;
+
+ /**
+ * The implementation object to which calls are redirected
+ */
+ // package-private because ServerSocket.implAccept() needs to access it.
+ SocketImpl impl;
+
+ /**
+ * True if socket implementation was created by calling their
+ * create() method.
+ */
+ // package-private because ServerSocket.implAccept() needs to access it.
+ boolean implCreated;
+
+ /**
+ * True if the socket is bound.
+ * Package private so it can be set from ServerSocket when accept is called.
+ */
+ boolean bound;
+
+ /**
+ * True if input is shutdown.
+ */
+ private boolean inputShutdown;
+
+ /**
+ * True if output is shutdown.
+ */
+ private boolean outputShutdown;
+
+ /**
+ * Initializes a new instance of <code>Socket</code> object without
+ * connecting to a remote host. This useful for subclasses of socket that
+ * might want this behavior.
+ *
+ * @specnote This constructor is public since JDK 1.4
+ * @since 1.1
+ */
+ public Socket()
+ {
+ if (factory != null)
+ impl = factory.createSocketImpl();
+ else
+ impl = new PlainSocketImpl();
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> object without
+ * connecting to a remote host. This is useful for subclasses of socket
+ * that might want this behavior.
+ * <p>
+ * Additionally, this socket will be created using the supplied
+ * implementation class instead the default class or one returned by a
+ * factory. If this value is <code>null</code>, the default Socket
+ * implementation is used.
+ *
+ * @param impl The <code>SocketImpl</code> to use for this
+ * <code>Socket</code>
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.1
+ */
+ protected Socket(SocketImpl impl) throws SocketException
+ {
+ if (impl == null)
+ this.impl = new PlainSocketImpl();
+ else
+ this.impl = impl;
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> and connects to the
+ * hostname and port specified as arguments.
+ *
+ * @param host The name of the host to connect to
+ * @param port The port number to connect to
+ *
+ * @exception UnknownHostException If the hostname cannot be resolved to a
+ * network address.
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ */
+ public Socket(String host, int port)
+ throws UnknownHostException, IOException
+ {
+ this(InetAddress.getByName(host), port, null, 0, true);
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> and connects to the
+ * address and port number specified as arguments.
+ *
+ * @param address The address to connect to
+ * @param port The port number to connect to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ */
+ public Socket(InetAddress address, int port) throws IOException
+ {
+ this(address, port, null, 0, true);
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> that connects to the
+ * named host on the specified port and binds to the specified local address
+ * and port.
+ *
+ * @param host The name of the remote host to connect to.
+ * @param port The remote port to connect to.
+ * @param localAddr The local address to bind to.
+ * @param localPort The local port to bind to.
+ *
+ * @exception SecurityException If the <code>SecurityManager</code>
+ * exists and does not allow a connection to the specified host/port or
+ * binding to the specified local host/port.
+ * @exception IOException If a connection error occurs.
+ *
+ * @since 1.1
+ */
+ public Socket(String host, int port, InetAddress localAddr, int localPort)
+ throws IOException
+ {
+ this(InetAddress.getByName(host), port, localAddr, localPort, true);
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> and connects to the
+ * address and port number specified as arguments, plus binds to the
+ * specified local address and port.
+ *
+ * @param address The remote address to connect to
+ * @param port The remote port to connect to
+ * @param localAddr The local address to connect to
+ * @param localPort The local port to connect to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ *
+ * @since 1.1
+ */
+ public Socket(InetAddress address, int port, InetAddress localAddr,
+ int localPort) throws IOException
+ {
+ this(address, port, localAddr, localPort, true);
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> and connects to the
+ * hostname and port specified as arguments. If the stream argument is set
+ * to <code>true</code>, then a stream socket is created. If it is
+ * <code>false</code>, a datagram socket is created.
+ *
+ * @param host The name of the host to connect to
+ * @param port The port to connect to
+ * @param stream <code>true</code> for a stream socket, <code>false</code>
+ * for a datagram socket
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ *
+ * @deprecated Use the <code>DatagramSocket</code> class to create
+ * datagram oriented sockets.
+ */
+ public Socket(String host, int port, boolean stream)
+ throws IOException
+ {
+ this(InetAddress.getByName(host), port, null, 0, stream);
+ }
+
+ /**
+ * Initializes a new instance of <code>Socket</code> and connects to the
+ * address and port number specified as arguments. If the stream param is
+ * <code>true</code>, a stream socket will be created, otherwise a datagram
+ * socket is created.
+ *
+ * @param host The address to connect to
+ * @param port The port number to connect to
+ * @param stream <code>true</code> to create a stream socket,
+ * <code>false</code> to create a datagram socket.
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ *
+ * @deprecated Use the <code>DatagramSocket</code> class to create
+ * datagram oriented sockets.
+ */
+ public Socket(InetAddress host, int port, boolean stream)
+ throws IOException
+ {
+ this(host, port, null, 0, stream);
+ }
+
+ /**
+ * This constructor is where the real work takes place. Connect to the
+ * specified address and port. Use default local values if not specified,
+ * otherwise use the local host and port passed in. Create as stream or
+ * datagram based on "stream" argument.
+ * <p>
+ *
+ * @param raddr The remote address to connect to
+ * @param rport The remote port to connect to
+ * @param laddr The local address to connect to
+ * @param lport The local port to connect to
+ * @param stream true for a stream socket, false for a datagram socket
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ */
+ private Socket(InetAddress raddr, int rport, InetAddress laddr, int lport,
+ boolean stream) throws IOException
+ {
+ this();
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect(raddr.getHostName(), rport);
+
+ // bind socket
+ SocketAddress bindaddr =
+ laddr == null ? null : new InetSocketAddress(laddr, lport);
+ bind(bindaddr);
+
+ // connect socket
+ connect(new InetSocketAddress(raddr, rport));
+
+ // FIXME: JCL p. 1586 says if localPort is unspecified, bind to any port,
+ // i.e. '0' and if localAddr is unspecified, use getLocalAddress() as
+ // that default. JDK 1.2 doc infers not to do a bind.
+ }
+
+ private SocketImpl getImpl() throws SocketException
+ {
+ try
+ {
+ if (! implCreated)
+ {
+ impl.create(true);
+ implCreated = true;
+ }
+ }
+ catch (IOException e)
+ {
+ SocketException se = new SocketException(e.toString());
+ se.initCause(e);
+ throw se;
+ }
+
+ return impl;
+ }
+
+ /**
+ * Binds the socket to the givent local address/port
+ *
+ * @param bindpoint The address/port to bind to
+ *
+ * @exception IOException If an error occurs
+ * @exception SecurityException If a security manager exists and its
+ * checkConnect method doesn't allow the operation
+ * @exception IllegalArgumentException If the address type is not supported
+ *
+ * @since 1.4
+ */
+ public void bind(SocketAddress bindpoint) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ // XXX: JDK 1.4.1 API documentation says that if bindpoint is null the
+ // socket will be bound to an ephemeral port and a valid local address.
+ if (bindpoint == null)
+ bindpoint = new InetSocketAddress(InetAddress.ANY_IF, 0);
+
+ if (! (bindpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException();
+
+ InetSocketAddress tmp = (InetSocketAddress) bindpoint;
+
+ // bind to address/port
+ try
+ {
+ getImpl().bind(tmp.getAddress(), tmp.getPort());
+ bound = true;
+ }
+ catch (IOException exception)
+ {
+ close();
+ throw exception;
+ }
+ catch (RuntimeException exception)
+ {
+ close();
+ throw exception;
+ }
+ catch (Error error)
+ {
+ close();
+ throw error;
+ }
+ }
+
+ /**
+ * Connects the socket with a remote address.
+ *
+ * @param endpoint The address to connect to
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If the addess type is not supported
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ *
+ * @since 1.4
+ */
+ public void connect(SocketAddress endpoint) throws IOException
+ {
+ connect(endpoint, 0);
+ }
+
+ /**
+ * Connects the socket with a remote address. A timeout of zero is
+ * interpreted as an infinite timeout. The connection will then block
+ * until established or an error occurs.
+ *
+ * @param endpoint The address to connect to
+ * @param timeout The length of the timeout in milliseconds, or
+ * 0 to indicate no timeout.
+ *
+ * @exception IOException If an error occurs
+ * @exception IllegalArgumentException If the address type is not supported
+ * @exception IllegalBlockingModeException If this socket has an associated
+ * channel, and the channel is in non-blocking mode
+ * @exception SocketTimeoutException If the timeout is reached
+ *
+ * @since 1.4
+ */
+ public void connect(SocketAddress endpoint, int timeout)
+ throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! (endpoint instanceof InetSocketAddress))
+ throw new IllegalArgumentException("unsupported address type");
+
+ // The Sun spec says that if we have an associated channel and
+ // it is in non-blocking mode, we throw an IllegalBlockingModeException.
+ // However, in our implementation if the channel itself initiated this
+ // operation, then we must honor it regardless of its blocking mode.
+ if (getChannel() != null && ! getChannel().isBlocking()
+ && ! ((PlainSocketImpl) getImpl()).isInChannelOperation())
+ throw new IllegalBlockingModeException();
+
+ if (! isBound())
+ bind(null);
+
+ getImpl().connect(endpoint, timeout);
+ }
+
+ /**
+ * Returns the address of the remote end of the socket. If this socket
+ * is not connected, then <code>null</code> is returned.
+ *
+ * @return The remote address this socket is connected to
+ */
+ public InetAddress getInetAddress()
+ {
+ if (! isConnected())
+ return null;
+
+ try
+ {
+ return getImpl().getInetAddress();
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are connected.
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the local address to which this socket is bound. If this socket
+ * is not connected, then a wildcard address, for which
+ * @see InetAddress#isAnyLocalAddress() is <code>true</code>, is returned.
+ *
+ * @return The local address
+ *
+ * @since 1.1
+ */
+ public InetAddress getLocalAddress()
+ {
+ if (! isBound())
+ return InetAddress.ANY_IF;
+
+ InetAddress addr = null;
+
+ try
+ {
+ addr = (InetAddress) getImpl().getOption(SocketOptions.SO_BINDADDR);
+ }
+ catch (SocketException e)
+ {
+ // (hopefully) shouldn't happen
+ // throw new java.lang.InternalError
+ // ("Error in PlainSocketImpl.getOption");
+ return null;
+ }
+
+ // FIXME: According to libgcj, checkConnect() is supposed to be called
+ // before performing this operation. Problems: 1) We don't have the
+ // addr until after we do it, so we do a post check. 2). The docs I
+ // see don't require this in the Socket case, only DatagramSocket, but
+ // we'll assume they mean both.
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkConnect(addr.getHostName(), getLocalPort());
+
+ return addr;
+ }
+
+ /**
+ * Returns the port number of the remote end of the socket connection. If
+ * this socket is not connected, then 0 is returned.
+ *
+ * @return The remote port this socket is connected to
+ */
+ public int getPort()
+ {
+ if (! isConnected())
+ return 0;
+
+ try
+ {
+ return getImpl().getPort();
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are connected.
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns the local port number to which this socket is bound. If this
+ * socket is not connected, then -1 is returned.
+ *
+ * @return The local port
+ */
+ public int getLocalPort()
+ {
+ if (! isBound())
+ return -1;
+
+ try
+ {
+ if (getImpl() != null)
+ return getImpl().getLocalPort();
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are bound.
+ }
+
+ return -1;
+ }
+
+ /**
+ * Returns local socket address.
+ *
+ * @return the local socket address, null if not bound
+ *
+ * @since 1.4
+ */
+ public SocketAddress getLocalSocketAddress()
+ {
+ if (! isBound())
+ return null;
+
+ InetAddress addr = getLocalAddress();
+
+ try
+ {
+ return new InetSocketAddress(addr, getImpl().getLocalPort());
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are bound.
+ return null;
+ }
+ }
+
+ /**
+ * Returns the remote socket address.
+ *
+ * @return the remote socket address, null of not connected
+ *
+ * @since 1.4
+ */
+ public SocketAddress getRemoteSocketAddress()
+ {
+ if (! isConnected())
+ return null;
+
+ try
+ {
+ return new InetSocketAddress(getImpl().getInetAddress(),
+ getImpl().getPort());
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are connected.
+ return null;
+ }
+ }
+
+ /**
+ * Returns an InputStream for reading from this socket.
+ *
+ * @return The InputStream object
+ *
+ * @exception IOException If an error occurs or Socket is not connected
+ */
+ public InputStream getInputStream() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! isConnected())
+ throw new IOException("not connected");
+
+ return getImpl().getInputStream();
+ }
+
+ /**
+ * Returns an OutputStream for writing to this socket.
+ *
+ * @return The OutputStream object
+ *
+ * @exception IOException If an error occurs or Socket is not connected
+ */
+ public OutputStream getOutputStream() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (! isConnected())
+ throw new IOException("not connected");
+
+ return getImpl().getOutputStream();
+ }
+
+ /**
+ * Sets the TCP_NODELAY option on the socket.
+ *
+ * @param on true to enable, false to disable
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.1
+ */
+ public void setTcpNoDelay(boolean on) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.TCP_NODELAY, Boolean.valueOf(on));
+ }
+
+ /**
+ * Tests whether or not the TCP_NODELAY option is set on the socket.
+ * Returns true if enabled, false if disabled. When on it disables the
+ * Nagle algorithm which means that packets are always send immediatly and
+ * never merged together to reduce network trafic.
+ *
+ * @return Whether or not TCP_NODELAY is set
+ *
+ * @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
+ */
+ public boolean getTcpNoDelay() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object on = getImpl().getOption(SocketOptions.TCP_NODELAY);
+
+ if (on instanceof Boolean)
+ return (((Boolean) on).booleanValue());
+ else
+ throw new SocketException("Internal Error");
+ }
+
+ /**
+ * Sets the value of the SO_LINGER option on the socket. If the
+ * SO_LINGER option is set on a socket and there is still data waiting to
+ * be sent when the socket is closed, then the close operation will block
+ * until either that data is delivered or until the timeout period
+ * expires. The linger interval is specified in hundreths of a second
+ * (platform specific?)
+ *
+ * @param on true to enable SO_LINGER, false to disable
+ * @param linger The SO_LINGER timeout in hundreths of a second or -1 if
+ * SO_LINGER not set.
+ *
+ * @exception SocketException If an error occurs or Socket not connected
+ * @exception IllegalArgumentException If linger is negative
+ *
+ * @since 1.1
+ */
+ public void setSoLinger(boolean on, int linger) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (on)
+ {
+ if (linger < 0)
+ throw new IllegalArgumentException("SO_LINGER must be >= 0");
+
+ if (linger > 65535)
+ linger = 65535;
+
+ getImpl().setOption(SocketOptions.SO_LINGER, new Integer(linger));
+ }
+ else
+ getImpl().setOption(SocketOptions.SO_LINGER, Boolean.valueOf(false));
+ }
+
+ /**
+ * Returns the value of the SO_LINGER option on the socket. If the
+ * SO_LINGER option is set on a socket and there is still data waiting to
+ * be sent when the socket is closed, then the close operation will block
+ * until either that data is delivered or until the timeout period
+ * expires. This method either returns the timeouts (in hundredths of
+ * of a second (platform specific?)) if SO_LINGER is set, or -1 if
+ * SO_LINGER is not set.
+ *
+ * @return The SO_LINGER timeout in hundreths of a second or -1
+ * if SO_LINGER not set
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.1
+ */
+ public int getSoLinger() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object linger = getImpl().getOption(SocketOptions.SO_LINGER);
+
+ if (linger instanceof Integer)
+ return (((Integer) linger).intValue());
+ else
+ return -1;
+ }
+
+ /**
+ * Sends urgent data through the socket
+ *
+ * @param data The data to send.
+ * Only the lowest eight bits of data are sent
+ *
+ * @exception IOException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void sendUrgentData(int data) throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().sendUrgentData(data);
+ }
+
+ /**
+ * Enables/disables the SO_OOBINLINE option
+ *
+ * @param on True if SO_OOBLINE should be enabled
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setOOBInline(boolean on) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.SO_OOBINLINE, Boolean.valueOf(on));
+ }
+
+ /**
+ * Returns the current setting of the SO_OOBINLINE option for this socket
+ *
+ * @return True if SO_OOBINLINE is set, false otherwise.
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getOOBInline() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_OOBINLINE);
+
+ if (buf instanceof Boolean)
+ return (((Boolean) buf).booleanValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
+ * Sets the value of the SO_TIMEOUT option on the socket. If this value
+ * is set, and an read/write is performed that does not complete within
+ * the timeout period, a short count is returned (or an EWOULDBLOCK signal
+ * would be sent in Unix if no data had been read). A value of 0 for
+ * this option implies that there is no timeout (ie, operations will
+ * block forever). On systems that have separate read and write timeout
+ * values, this method returns the read timeout. This
+ * value is in milliseconds.
+ *
+ * @param timeout The length of the timeout in milliseconds, or
+ * 0 to indicate no timeout.
+ *
+ * @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
+ */
+ public synchronized void setSoTimeout(int timeout) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (timeout < 0)
+ throw new IllegalArgumentException("SO_TIMEOUT value must be >= 0");
+
+ getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ }
+
+ /**
+ * Returns the value of the SO_TIMEOUT option on the socket. If this value
+ * is set, and an read/write is performed that does not complete within
+ * the timeout period, a short count is returned (or an EWOULDBLOCK signal
+ * would be sent in Unix if no data had been read). A value of 0 for
+ * this option implies that there is no timeout (ie, operations will
+ * block forever). On systems that have separate read and write timeout
+ * values, this method returns the read timeout. This
+ * value is in thousandths of a second (implementation specific?).
+ *
+ * @return The length of the timeout in thousandth's of a second or 0
+ * if not set
+ *
+ * @exception SocketException If an error occurs or Socket not connected
+ *
+ * @since 1.1
+ */
+ public synchronized int getSoTimeout() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object timeout = getImpl().getOption(SocketOptions.SO_TIMEOUT);
+ if (timeout instanceof Integer)
+ return (((Integer) timeout).intValue());
+ else
+ return 0;
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_SNDBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
+ *
+ * @param size The new send buffer size.
+ *
+ * @exception SocketException If an error occurs or Socket not connected
+ * @exception IllegalArgumentException If size is 0 or negative
+ *
+ * @since 1.2
+ */
+ public void setSendBufferSize(int size) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (size <= 0)
+ throw new IllegalArgumentException("SO_SNDBUF value must be > 0");
+
+ getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+ }
+
+ /**
+ * This method returns the value of the system level socket option
+ * SO_SNDBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ * @return The send buffer size.
+ *
+ * @exception SocketException If an error occurs or socket not connected
+ *
+ * @since 1.2
+ */
+ public int getSendBufferSize() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_SNDBUF);
+
+ if (buf instanceof Integer)
+ return (((Integer) buf).intValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
+ * This method sets the value for the system level socket option
+ * SO_RCVBUF to the specified value. Note that valid values for this
+ * option are specific to a given operating system.
+ *
+ * @param size The new receive buffer size.
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ * @exception IllegalArgumentException If size is 0 or negative
+ *
+ * @since 1.2
+ */
+ public void setReceiveBufferSize(int size) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (size <= 0)
+ throw new IllegalArgumentException("SO_RCVBUF value must be > 0");
+
+ getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+ }
+
+ /**
+ * This method returns the value of the system level socket option
+ * SO_RCVBUF, which is used by the operating system to tune buffer
+ * sizes for data transfers.
+ *
+ * @return The receive buffer size.
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.2
+ */
+ public int getReceiveBufferSize() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_RCVBUF);
+
+ if (buf instanceof Integer)
+ return (((Integer) buf).intValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
+ * This method sets the value for the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @param on True if SO_KEEPALIVE should be enabled
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.3
+ */
+ public void setKeepAlive(boolean on) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.SO_KEEPALIVE, Boolean.valueOf(on));
+ }
+
+ /**
+ * This method returns the value of the socket level socket option
+ * SO_KEEPALIVE.
+ *
+ * @return The setting
+ *
+ * @exception SocketException If an error occurs or Socket is not connected
+ *
+ * @since 1.3
+ */
+ public boolean getKeepAlive() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object buf = getImpl().getOption(SocketOptions.SO_KEEPALIVE);
+
+ if (buf instanceof Boolean)
+ return (((Boolean) buf).booleanValue());
+ else
+ throw new SocketException("Internal Error: Unexpected type");
+ }
+
+ /**
+ * Closes the socket.
+ *
+ * @exception IOException If an error occurs
+ */
+ public synchronized void close() throws IOException
+ {
+ if (isClosed())
+ return;
+
+ getImpl().close();
+ impl = null;
+ bound = false;
+
+ if (getChannel() != null)
+ getChannel().close();
+ }
+
+ /**
+ * Converts this <code>Socket</code> to a <code>String</code>.
+ *
+ * @return The <code>String</code> representation of this <code>Socket</code>
+ */
+ public String toString()
+ {
+ try
+ {
+ if (isConnected())
+ return ("Socket[addr=" + getImpl().getInetAddress() + ",port="
+ + getImpl().getPort() + ",localport="
+ + getImpl().getLocalPort() + "]");
+ }
+ catch (SocketException e)
+ {
+ // This cannot happen as we are connected.
+ }
+
+ return "Socket[unconnected]";
+ }
+
+ /**
+ * Sets the <code>SocketImplFactory</code>. This may be done only once per
+ * virtual machine. Subsequent attempts will generate a
+ * <code>SocketException</code>. Note that a <code>SecurityManager</code>
+ * check is made prior to setting the factory. If
+ * insufficient privileges exist to set the factory, then an
+ * <code>IOException</code> will be thrown.
+ *
+ * @param fac the factory to set
+ *
+ * @exception SecurityException If the <code>SecurityManager</code> does
+ * not allow this operation.
+ * @exception SocketException If the SocketImplFactory is already defined
+ * @exception IOException If any other error occurs
+ */
+ public static synchronized void setSocketImplFactory(SocketImplFactory fac)
+ throws IOException
+ {
+ // See if already set
+ if (factory != null)
+ throw new SocketException("SocketImplFactory already defined");
+
+ // Check permissions
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSetFactory();
+
+ if (fac == null)
+ throw new SocketException("SocketImplFactory cannot be null");
+
+ factory = fac;
+ }
+
+ /**
+ * Closes the input side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ *
+ * @since 1.3
+ */
+ public void shutdownInput() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().shutdownInput();
+ inputShutdown = true;
+ }
+
+ /**
+ * Closes the output side of the socket stream.
+ *
+ * @exception IOException If an error occurs.
+ *
+ * @since 1.3
+ */
+ public void shutdownOutput() throws IOException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().shutdownOutput();
+ outputShutdown = true;
+ }
+
+ /**
+ * Returns the socket channel associated with this socket.
+ *
+ * @return the associated socket channel,
+ * null if no associated channel exists
+ *
+ * @since 1.4
+ */
+ public SocketChannel getChannel()
+ {
+ return null;
+ }
+
+ /**
+ * Checks if the SO_REUSEADDR option is enabled
+ *
+ * @return True if SO_REUSEADDR is set, false otherwise.
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public boolean getReuseAddress() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object reuseaddr = getImpl().getOption(SocketOptions.SO_REUSEADDR);
+
+ if (! (reuseaddr instanceof Boolean))
+ throw new SocketException("Internal Error");
+
+ return ((Boolean) reuseaddr).booleanValue();
+ }
+
+ /**
+ * Enables/Disables the SO_REUSEADDR option
+ *
+ * @param reuseAddress true if SO_REUSEADDR should be enabled,
+ * false otherwise
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @since 1.4
+ */
+ public void setReuseAddress(boolean reuseAddress) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ getImpl().setOption(SocketOptions.SO_REUSEADDR,
+ Boolean.valueOf(reuseAddress));
+ }
+
+ /**
+ * Returns the current traffic class
+ *
+ * @return The current traffic class.
+ *
+ * @exception SocketException If an error occurs
+ *
+ * @see Socket#setTrafficClass(int tc)
+ *
+ * @since 1.4
+ */
+ public int getTrafficClass() throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ Object obj = getImpl().getOption(SocketOptions.IP_TOS);
+
+ if (obj instanceof Integer)
+ return ((Integer) obj).intValue();
+ else
+ throw new SocketException("Unexpected type");
+ }
+
+ /**
+ * Sets the traffic class value
+ *
+ * @param tc The traffic class
+ *
+ * @exception SocketException If an error occurs
+ * @exception IllegalArgumentException If tc value is illegal
+ *
+ * @see Socket#getTrafficClass()
+ *
+ * @since 1.4
+ */
+ public void setTrafficClass(int tc) throws SocketException
+ {
+ if (isClosed())
+ throw new SocketException("socket is closed");
+
+ if (tc < 0 || tc > 255)
+ throw new IllegalArgumentException();
+
+ getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+ }
+
+ /**
+ * Checks if the socket is connected
+ *
+ * @return True if socket is connected, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isConnected()
+ {
+ try
+ {
+ if (getImpl() == null)
+ return false;
+
+ return getImpl().getInetAddress() != null;
+ }
+ catch (SocketException e)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Checks if the socket is already bound.
+ *
+ * @return True if socket is bound, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isBound()
+ {
+ return bound;
+ }
+
+ /**
+ * Checks if the socket is closed.
+ *
+ * @return True if socket is closed, false otherwise.
+ *
+ * @since 1.4
+ */
+ public boolean isClosed()
+ {
+ return impl == null;
+ }
+
+ /**
+ * Checks if the socket's input stream is shutdown
+ *
+ * @return True if input is shut down.
+ *
+ * @since 1.4
+ */
+ public boolean isInputShutdown()
+ {
+ return inputShutdown;
+ }
+
+ /**
+ * Checks if the socket's output stream is shutdown
+ *
+ * @return True if output is shut down.
+ *
+ * @since 1.4
+ */
+ public boolean isOutputShutdown()
+ {
+ return outputShutdown;
+ }
+}
diff --git a/libjava/java/net/SocketAddress.h b/libjava/java/net/SocketAddress.h
new file mode 100644
index 00000000000..42f0f21b101
--- /dev/null
+++ b/libjava/java/net/SocketAddress.h
@@ -0,0 +1,32 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketAddress__
+#define __java_net_SocketAddress__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class SocketAddress;
+ }
+ }
+}
+
+class java::net::SocketAddress : public ::java::lang::Object
+{
+
+public:
+ SocketAddress();
+public: // actually package-private
+ static const jlong serialVersionUID = 5215720748342549866LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_SocketAddress__
diff --git a/libjava/java/net/SocketException.h b/libjava/java/net/SocketException.h
new file mode 100644
index 00000000000..563e7f13b1e
--- /dev/null
+++ b/libjava/java/net/SocketException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketException__
+#define __java_net_SocketException__
+
+#pragma interface
+
+#include <java/io/IOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class SocketException;
+ }
+ }
+}
+
+class java::net::SocketException : public ::java::io::IOException
+{
+
+public:
+ SocketException();
+ SocketException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -5935874303556886934LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_SocketException__
diff --git a/libjava/java/net/SocketImpl.h b/libjava/java/net/SocketImpl.h
new file mode 100644
index 00000000000..0daf5146da0
--- /dev/null
+++ b/libjava/java/net/SocketImpl.h
@@ -0,0 +1,63 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketImpl__
+#define __java_net_SocketImpl__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class SocketAddress;
+ class SocketImpl;
+ }
+ }
+}
+
+class java::net::SocketImpl : public ::java::lang::Object
+{
+
+public:
+ SocketImpl();
+public: // actually protected
+ virtual void create(jboolean) = 0;
+ virtual void connect(::java::lang::String *, jint) = 0;
+ virtual void connect(::java::net::InetAddress *, jint) = 0;
+ virtual void connect(::java::net::SocketAddress *, jint) = 0;
+ virtual void bind(::java::net::InetAddress *, jint) = 0;
+ virtual void listen(jint) = 0;
+ virtual void accept(::java::net::SocketImpl *) = 0;
+ virtual ::java::io::InputStream * getInputStream() = 0;
+ virtual ::java::io::OutputStream * getOutputStream() = 0;
+ virtual jint available() = 0;
+ virtual void close() = 0;
+ virtual ::java::io::FileDescriptor * getFileDescriptor();
+ virtual ::java::net::InetAddress * getInetAddress();
+ virtual jint getPort();
+ virtual jboolean supportsUrgentData();
+ virtual void sendUrgentData(jint) = 0;
+ virtual jint getLocalPort();
+public:
+ virtual ::java::lang::String * toString();
+public: // actually protected
+ virtual void shutdownInput();
+ virtual void shutdownOutput();
+public:
+ virtual void setOption(jint, ::java::lang::Object *) = 0;
+ virtual ::java::lang::Object * getOption(jint) = 0;
+public: // actually protected
+ ::java::net::InetAddress * __attribute__((aligned(__alignof__( ::java::lang::Object)))) address;
+ ::java::io::FileDescriptor * fd;
+ jint localport;
+ jint port;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_SocketImpl__
diff --git a/libjava/java/net/SocketImplFactory.h b/libjava/java/net/SocketImplFactory.h
new file mode 100644
index 00000000000..2089846dfcc
--- /dev/null
+++ b/libjava/java/net/SocketImplFactory.h
@@ -0,0 +1,30 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketImplFactory__
+#define __java_net_SocketImplFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class SocketImpl;
+ class SocketImplFactory;
+ }
+ }
+}
+
+class java::net::SocketImplFactory : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::net::SocketImpl * createSocketImpl() = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_SocketImplFactory__
diff --git a/libjava/java/net/SocketOptions.h b/libjava/java/net/SocketOptions.h
new file mode 100644
index 00000000000..6a56d13468d
--- /dev/null
+++ b/libjava/java/net/SocketOptions.h
@@ -0,0 +1,44 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketOptions__
+#define __java_net_SocketOptions__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class SocketOptions;
+ }
+ }
+}
+
+class java::net::SocketOptions : public ::java::lang::Object
+{
+
+public:
+ virtual void setOption(jint, ::java::lang::Object *) = 0;
+ virtual ::java::lang::Object * getOption(jint) = 0;
+ static const jint SO_KEEPALIVE = 8;
+ static const jint SO_LINGER = 128;
+ static const jint SO_TIMEOUT = 4102;
+ static const jint SO_BINDADDR = 15;
+ static const jint SO_SNDBUF = 4097;
+ static const jint SO_RCVBUF = 4098;
+ static const jint SO_REUSEADDR = 4;
+ static const jint SO_BROADCAST = 32;
+ static const jint SO_OOBINLINE = 4099;
+ static const jint TCP_NODELAY = 1;
+ static const jint IP_MULTICAST_IF = 16;
+ static const jint IP_MULTICAST_IF2 = 31;
+ static const jint IP_MULTICAST_LOOP = 18;
+ static const jint IP_TOS = 3;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_SocketOptions__
diff --git a/libjava/java/net/SocketPermission.h b/libjava/java/net/SocketPermission.h
new file mode 100644
index 00000000000..dae8e83afd9
--- /dev/null
+++ b/libjava/java/net/SocketPermission.h
@@ -0,0 +1,68 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketPermission__
+#define __java_net_SocketPermission__
+
+#pragma interface
+
+#include <java/security/Permission.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class SocketPermission;
+ }
+ namespace security
+ {
+ class Permission;
+ class PermissionCollection;
+ }
+ }
+}
+
+class java::net::SocketPermission : public ::java::security::Permission
+{
+
+public:
+ SocketPermission(::java::lang::String *, ::java::lang::String *);
+private:
+ static ::java::lang::String * processHostport(::java::lang::String *);
+ void setHostPort(::java::lang::String *);
+ void setActions(::java::lang::String *);
+ void setAction(::java::lang::String *);
+public:
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ ::java::lang::String * getActions();
+ ::java::security::PermissionCollection * newPermissionCollection();
+private:
+ JArray< ::java::net::InetAddress * > * getAddresses();
+ ::java::lang::String * getCanonicalHostName();
+public:
+ jboolean implies(::java::security::Permission *);
+private:
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+public: // actually package-private
+ static const jlong serialVersionUID = -7204263841984476862LL;
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::security::Permission)))) hostname;
+ ::java::net::InetAddress * address;
+ jint minport;
+ jint maxport;
+ static const jint MIN_PORT = 0;
+ static const jint MAX_PORT = 2147483647;
+ ::java::lang::String * actions;
+ jint actionmask;
+ static JArray< ::java::lang::String * > * ACTIONS;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_SocketPermission__
diff --git a/libjava/java/net/SocketTimeoutException.h b/libjava/java/net/SocketTimeoutException.h
new file mode 100644
index 00000000000..a32424b91d7
--- /dev/null
+++ b/libjava/java/net/SocketTimeoutException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_SocketTimeoutException__
+#define __java_net_SocketTimeoutException__
+
+#pragma interface
+
+#include <java/io/InterruptedIOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class SocketTimeoutException;
+ }
+ }
+}
+
+class java::net::SocketTimeoutException : public ::java::io::InterruptedIOException
+{
+
+public:
+ SocketTimeoutException();
+ SocketTimeoutException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -8846654841826352300LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_SocketTimeoutException__
diff --git a/libjava/java/net/URI.h b/libjava/java/net/URI.h
new file mode 100644
index 00000000000..9c8f4f2d1fc
--- /dev/null
+++ b/libjava/java/net/URI.h
@@ -0,0 +1,134 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URI__
+#define __java_net_URI__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URI;
+ class URL;
+ }
+ }
+}
+
+class java::net::URI : public ::java::lang::Object
+{
+
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+ static ::java::lang::String * getURIGroup(::java::util::regex::Matcher *, jint);
+ void parseURI(::java::lang::String *);
+ static ::java::lang::String * unquote(::java::lang::String *);
+ static ::java::lang::String * quote(::java::lang::String *);
+ static ::java::lang::String * quoteAuthority(::java::lang::String *);
+ static ::java::lang::String * quote(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::String * quoteHost(::java::lang::String *);
+ static ::java::lang::String * quotePath(::java::lang::String *);
+ static ::java::lang::String * quoteUserInfo(::java::lang::String *);
+public:
+ URI(::java::lang::String *);
+ URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ URI(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ static ::java::net::URI * create(::java::lang::String *);
+ ::java::net::URI * parseServerAuthority();
+ ::java::net::URI * normalize();
+private:
+ ::java::lang::String * normalizePath(::java::lang::String *);
+ void removeLastSegment(::java::lang::StringBuffer *);
+public:
+ ::java::net::URI * resolve(::java::net::URI *);
+ ::java::net::URI * resolve(::java::lang::String *);
+ ::java::net::URI * relativize(::java::net::URI *);
+ ::java::net::URL * toURL();
+ ::java::lang::String * getScheme();
+ jboolean isAbsolute();
+ jboolean isOpaque();
+ ::java::lang::String * getRawSchemeSpecificPart();
+ ::java::lang::String * getSchemeSpecificPart();
+ ::java::lang::String * getRawAuthority();
+ ::java::lang::String * getAuthority();
+ ::java::lang::String * getRawUserInfo();
+ ::java::lang::String * getUserInfo();
+ ::java::lang::String * getHost();
+ jint getPort();
+ ::java::lang::String * getRawPath();
+ ::java::lang::String * getPath();
+ ::java::lang::String * getRawQuery();
+ ::java::lang::String * getQuery();
+ ::java::lang::String * getRawFragment();
+ ::java::lang::String * getFragment();
+ jboolean equals(::java::lang::Object *);
+ jint hashCode();
+ jint target$compareTo(::java::net::URI *);
+private:
+ jint compareFragments(::java::net::URI *);
+public:
+ ::java::lang::String * toString();
+ ::java::lang::String * toASCIIString();
+private:
+ static ::java::lang::String * escapeCharacters(::java::lang::String *);
+public:
+ jint compareTo(::java::lang::Object *);
+public: // actually package-private
+ static const jlong serialVersionUID = -6052424284110960213LL;
+private:
+ static ::java::lang::String * URI_REGEXP;
+ static ::java::lang::String * AUTHORITY_REGEXP;
+ static ::java::lang::String * RFC2396_DIGIT;
+ static ::java::lang::String * RFC2396_LOWALPHA;
+ static ::java::lang::String * RFC2396_UPALPHA;
+ static ::java::lang::String * RFC2396_ALPHA;
+ static ::java::lang::String * RFC2396_ALPHANUM;
+ static ::java::lang::String * RFC3986_UNRESERVED;
+ static ::java::lang::String * RFC3986_SUBDELIMS;
+ static ::java::lang::String * RFC3986_REG_NAME;
+ static ::java::lang::String * RFC3986_PCHAR;
+ static ::java::lang::String * RFC3986_SEGMENT;
+ static ::java::lang::String * RFC3986_PATH_SEGMENTS;
+ static ::java::lang::String * RFC3986_SSP;
+ static ::java::lang::String * RFC3986_HOST;
+ static ::java::lang::String * RFC3986_USERINFO;
+ static const jint SCHEME_GROUP = 2;
+ static const jint SCHEME_SPEC_PART_GROUP = 3;
+ static const jint AUTHORITY_GROUP = 5;
+ static const jint PATH_GROUP = 6;
+ static const jint QUERY_GROUP = 8;
+ static const jint FRAGMENT_GROUP = 10;
+ static const jint AUTHORITY_USERINFO_GROUP = 2;
+ static const jint AUTHORITY_HOST_GROUP = 3;
+ static const jint AUTHORITY_PORT_GROUP = 5;
+ static ::java::util::regex::Pattern * URI_PATTERN;
+ static ::java::util::regex::Pattern * AUTHORITY_PATTERN;
+ static ::java::lang::String * HEX;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) scheme;
+ ::java::lang::String * rawSchemeSpecificPart;
+ ::java::lang::String * schemeSpecificPart;
+ ::java::lang::String * rawAuthority;
+ ::java::lang::String * authority;
+ ::java::lang::String * rawUserInfo;
+ ::java::lang::String * userInfo;
+ ::java::lang::String * rawHost;
+ ::java::lang::String * host;
+ jint port;
+ ::java::lang::String * rawPath;
+ ::java::lang::String * path;
+ ::java::lang::String * rawQuery;
+ ::java::lang::String * query;
+ ::java::lang::String * rawFragment;
+ ::java::lang::String * fragment;
+ ::java::lang::String * string;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URI__
diff --git a/libjava/java/net/URISyntaxException.h b/libjava/java/net/URISyntaxException.h
new file mode 100644
index 00000000000..93f1a4e6651
--- /dev/null
+++ b/libjava/java/net/URISyntaxException.h
@@ -0,0 +1,39 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URISyntaxException__
+#define __java_net_URISyntaxException__
+
+#pragma interface
+
+#include <java/lang/Exception.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URISyntaxException;
+ }
+ }
+}
+
+class java::net::URISyntaxException : public ::java::lang::Exception
+{
+
+public:
+ URISyntaxException(::java::lang::String *, ::java::lang::String *);
+ URISyntaxException(::java::lang::String *, ::java::lang::String *, jint);
+ virtual ::java::lang::String * getInput();
+ virtual ::java::lang::String * getReason();
+ virtual jint getIndex();
+ virtual ::java::lang::String * getMessage();
+private:
+ static const jlong serialVersionUID = 2137979680897488891LL;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Exception)))) input;
+ jint index;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URISyntaxException__
diff --git a/libjava/java/net/URL$1.h b/libjava/java/net/URL$1.h
new file mode 100644
index 00000000000..d81ebe4bc0d
--- /dev/null
+++ b/libjava/java/net/URL$1.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URL$1__
+#define __java_net_URL$1__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL$1;
+ }
+ }
+}
+
+class java::net::URL$1 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ URL$1();
+public:
+ ::java::lang::Object * run();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URL$1__
diff --git a/libjava/java/net/URL.h b/libjava/java/net/URL.h
new file mode 100644
index 00000000000..536d89ca1fb
--- /dev/null
+++ b/libjava/java/net/URL.h
@@ -0,0 +1,89 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URL__
+#define __java_net_URL__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URI;
+ class URL;
+ class URLConnection;
+ class URLStreamHandler;
+ class URLStreamHandlerFactory;
+ }
+ }
+}
+
+class java::net::URL : public ::java::lang::Object
+{
+
+public:
+ URL(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *);
+ URL(::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ URL(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::net::URLStreamHandler *);
+ URL(::java::lang::String *);
+ URL(::java::net::URL *, ::java::lang::String *);
+ URL(::java::net::URL *, ::java::lang::String *, ::java::net::URLStreamHandler *);
+ jboolean equals(::java::lang::Object *);
+ ::java::lang::Object * getContent();
+ ::java::lang::Object * getContent(JArray< ::java::lang::Class * > *);
+ ::java::lang::String * getFile();
+ ::java::lang::String * getPath();
+ ::java::lang::String * getAuthority();
+ ::java::lang::String * getHost();
+ jint getPort();
+ jint getDefaultPort();
+ ::java::lang::String * getProtocol();
+ ::java::lang::String * getRef();
+ ::java::lang::String * getUserInfo();
+ ::java::lang::String * getQuery();
+ jint hashCode();
+ ::java::net::URLConnection * openConnection();
+ ::java::io::InputStream * openStream();
+ jboolean sameFile(::java::net::URL *);
+public: // actually protected
+ void set(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *);
+ void set(::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+public:
+ static void setURLStreamHandlerFactory(::java::net::URLStreamHandlerFactory *);
+ ::java::lang::String * toExternalForm();
+ ::java::lang::String * toString();
+private:
+ static ::java::net::URLStreamHandler * getURLStreamHandler(::java::lang::String *);
+ void readObject(::java::io::ObjectInputStream *);
+ void writeObject(::java::io::ObjectOutputStream *);
+public:
+ ::java::net::URI * toURI();
+private:
+ static ::java::lang::String * DEFAULT_SEARCH_PATH;
+ static ::java::lang::ClassLoader * systemClassLoader;
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) protocol;
+ ::java::lang::String * authority;
+ ::java::lang::String * host;
+ ::java::lang::String * userInfo;
+ jint port;
+ ::java::lang::String * file;
+ ::java::lang::String * ref;
+ jint hashCode__;
+public: // actually package-private
+ ::java::net::URLStreamHandler * ph;
+private:
+ static ::java::net::URLStreamHandlerFactory * factory;
+ static const jlong serialVersionUID = -7627629688361524110LL;
+ static ::java::util::HashMap * ph_cache;
+ static jboolean cache_handlers;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URL__
diff --git a/libjava/java/net/URLClassLoader$1.h b/libjava/java/net/URLClassLoader$1.h
new file mode 100644
index 00000000000..d7f57791125
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$1.h
@@ -0,0 +1,45 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$1__
+#define __java_net_URLClassLoader$1__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URLClassLoader;
+ class URLClassLoader$1;
+ }
+ namespace security
+ {
+ class CodeSource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$1 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ URLClassLoader$1(::java::net::URLClassLoader *, ::java::lang::String *, JArray< jbyte > *, ::java::security::CodeSource *);
+public:
+ ::java::lang::Object * run();
+public: // actually package-private
+ ::java::net::URLClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0;
+private:
+ ::java::lang::String * val$className;
+ JArray< jbyte > * val$classData;
+ ::java::security::CodeSource * val$source;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$1__
diff --git a/libjava/java/net/URLClassLoader$2.h b/libjava/java/net/URLClassLoader$2.h
new file mode 100644
index 00000000000..274d4c33a1e
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$2.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$2__
+#define __java_net_URLClassLoader$2__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URLClassLoader$2;
+ }
+ }
+}
+
+class java::net::URLClassLoader$2 : public ::java::lang::Object
+{
+
+public: // actually package-private
+ URLClassLoader$2(::java::lang::ClassLoader *, ::java::lang::Object *);
+public:
+ ::java::lang::Object * run();
+private:
+ ::java::lang::ClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) val$parent;
+ ::java::lang::Object * val$securityContext;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$2__
diff --git a/libjava/java/net/URLClassLoader$CoreResource.h b/libjava/java/net/URLClassLoader$CoreResource.h
new file mode 100644
index 00000000000..ff3314a33bf
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$CoreResource.h
@@ -0,0 +1,46 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$CoreResource__
+#define __java_net_URLClassLoader$CoreResource__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$Resource.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ class Core;
+ }
+ }
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$CoreResource;
+ class URLClassLoader$CoreURLLoader;
+ }
+ }
+}
+
+class java::net::URLClassLoader$CoreResource : public ::java::net::URLClassLoader$Resource
+{
+
+public: // actually package-private
+ URLClassLoader$CoreResource(::java::net::URLClassLoader$CoreURLLoader *, ::java::lang::String *, ::gnu::gcj::Core *);
+ ::java::io::InputStream * getInputStream();
+public:
+ jint getLength();
+ ::java::net::URL * getURL();
+private:
+ ::gnu::gcj::Core * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) core;
+ ::java::lang::String * name;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$CoreResource__
diff --git a/libjava/java/net/URLClassLoader$CoreURLLoader.h b/libjava/java/net/URLClassLoader$CoreURLLoader.h
new file mode 100644
index 00000000000..3c701cddf3a
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$CoreURLLoader.h
@@ -0,0 +1,36 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$CoreURLLoader__
+#define __java_net_URLClassLoader$CoreURLLoader__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$URLLoader.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$CoreURLLoader;
+ class URLClassLoader$Resource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$CoreURLLoader : public ::java::net::URLClassLoader$URLLoader
+{
+
+public: // actually package-private
+ URLClassLoader$CoreURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
+ ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) dir;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$CoreURLLoader__
diff --git a/libjava/java/net/URLClassLoader$FileResource.h b/libjava/java/net/URLClassLoader$FileResource.h
new file mode 100644
index 00000000000..a98e9bf223a
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$FileResource.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$FileResource__
+#define __java_net_URLClassLoader$FileResource__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$Resource.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$FileResource;
+ class URLClassLoader$FileURLLoader;
+ }
+ }
+}
+
+class java::net::URLClassLoader$FileResource : public ::java::net::URLClassLoader$Resource
+{
+
+public: // actually package-private
+ URLClassLoader$FileResource(::java::net::URLClassLoader$FileURLLoader *, ::java::io::File *);
+ ::java::io::InputStream * getInputStream();
+public:
+ jint getLength();
+ ::java::net::URL * getURL();
+public: // actually package-private
+ ::java::io::File * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) file;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$FileResource__
diff --git a/libjava/java/net/URLClassLoader$FileURLLoader.h b/libjava/java/net/URLClassLoader$FileURLLoader.h
new file mode 100644
index 00000000000..ff0b7dc7ce6
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$FileURLLoader.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$FileURLLoader__
+#define __java_net_URLClassLoader$FileURLLoader__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$URLLoader.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$FileURLLoader;
+ class URLClassLoader$Resource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$FileURLLoader : public ::java::net::URLClassLoader$URLLoader
+{
+
+public: // actually package-private
+ URLClassLoader$FileURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
+ ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
+ ::java::io::File * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) dir;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$FileURLLoader__
diff --git a/libjava/java/net/URLClassLoader$JarURLLoader.h b/libjava/java/net/URLClassLoader$JarURLLoader.h
new file mode 100644
index 00000000000..f1a36153a2c
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$JarURLLoader.h
@@ -0,0 +1,40 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$JarURLLoader__
+#define __java_net_URLClassLoader$JarURLLoader__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$URLLoader.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$JarURLLoader;
+ class URLClassLoader$Resource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$JarURLLoader : public ::java::net::URLClassLoader$URLLoader
+{
+
+public:
+ URLClassLoader$JarURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
+public: // actually package-private
+ ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
+ ::java::util::jar::Manifest * getManifest();
+ ::java::util::Vector * getClassPath();
+ ::java::util::jar::JarFile * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) jarfile;
+ ::java::net::URL * baseJarURL;
+ ::java::util::Vector * classPath;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$JarURLLoader__
diff --git a/libjava/java/net/URLClassLoader$JarURLResource.h b/libjava/java/net/URLClassLoader$JarURLResource.h
new file mode 100644
index 00000000000..0db0fdeec99
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$JarURLResource.h
@@ -0,0 +1,48 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$JarURLResource__
+#define __java_net_URLClassLoader$JarURLResource__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$Resource.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$JarURLLoader;
+ class URLClassLoader$JarURLResource;
+ }
+ namespace security
+ {
+ namespace cert
+ {
+ class Certificate;
+ }
+ }
+ }
+}
+
+class java::net::URLClassLoader$JarURLResource : public ::java::net::URLClassLoader$Resource
+{
+
+public: // actually package-private
+ URLClassLoader$JarURLResource(::java::net::URLClassLoader$JarURLLoader *, ::java::lang::String *, ::java::util::jar::JarEntry *);
+ ::java::io::InputStream * getInputStream();
+ jint getLength();
+ JArray< ::java::security::cert::Certificate * > * getCertificates();
+ ::java::net::URL * getURL();
+private:
+ ::java::util::jar::JarEntry * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) entry;
+ ::java::lang::String * name;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$JarURLResource__
diff --git a/libjava/java/net/URLClassLoader$RemoteResource.h b/libjava/java/net/URLClassLoader$RemoteResource.h
new file mode 100644
index 00000000000..10d2622c9fe
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$RemoteResource.h
@@ -0,0 +1,40 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$RemoteResource__
+#define __java_net_URLClassLoader$RemoteResource__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$Resource.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$RemoteResource;
+ class URLClassLoader$RemoteURLLoader;
+ }
+ }
+}
+
+class java::net::URLClassLoader$RemoteResource : public ::java::net::URLClassLoader$Resource
+{
+
+public: // actually package-private
+ URLClassLoader$RemoteResource(::java::net::URLClassLoader$RemoteURLLoader *, ::java::lang::String *, ::java::net::URL *, ::java::io::InputStream *, jint);
+ ::java::io::InputStream * getInputStream();
+public:
+ jint getLength();
+ ::java::net::URL * getURL();
+private:
+ ::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) url;
+ ::java::io::InputStream * stream;
+ jint length;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$RemoteResource__
diff --git a/libjava/java/net/URLClassLoader$RemoteURLLoader.h b/libjava/java/net/URLClassLoader$RemoteURLLoader.h
new file mode 100644
index 00000000000..7c2876b4ef6
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$RemoteURLLoader.h
@@ -0,0 +1,36 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$RemoteURLLoader__
+#define __java_net_URLClassLoader$RemoteURLLoader__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$URLLoader.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$RemoteURLLoader;
+ class URLClassLoader$Resource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$RemoteURLLoader : public ::java::net::URLClassLoader$URLLoader
+{
+
+public: // actually package-private
+ URLClassLoader$RemoteURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
+ ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
+private:
+ ::java::lang::String * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) protocol;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$RemoteURLLoader__
diff --git a/libjava/java/net/URLClassLoader$Resource.h b/libjava/java/net/URLClassLoader$Resource.h
new file mode 100644
index 00000000000..7fc102a9224
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$Resource.h
@@ -0,0 +1,48 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$Resource__
+#define __java_net_URLClassLoader$Resource__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$Resource;
+ class URLClassLoader$URLLoader;
+ }
+ namespace security
+ {
+ class CodeSource;
+ namespace cert
+ {
+ class Certificate;
+ }
+ }
+ }
+}
+
+class java::net::URLClassLoader$Resource : public ::java::lang::Object
+{
+
+public: // actually package-private
+ URLClassLoader$Resource(::java::net::URLClassLoader$URLLoader *);
+ virtual ::java::security::CodeSource * getCodeSource();
+ virtual JArray< ::java::security::cert::Certificate * > * getCertificates();
+ virtual ::java::net::URL * getURL() = 0;
+ virtual jint getLength() = 0;
+ virtual ::java::io::InputStream * getInputStream() = 0;
+ ::java::net::URLClassLoader$URLLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) loader;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$Resource__
diff --git a/libjava/java/net/URLClassLoader$SoResource.h b/libjava/java/net/URLClassLoader$SoResource.h
new file mode 100644
index 00000000000..dce7601125f
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$SoResource.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$SoResource__
+#define __java_net_URLClassLoader$SoResource__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$Resource.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader$SoResource;
+ class URLClassLoader$SoURLLoader;
+ }
+ }
+}
+
+class java::net::URLClassLoader$SoResource : public ::java::net::URLClassLoader$Resource
+{
+
+public: // actually package-private
+ URLClassLoader$SoResource(::java::net::URLClassLoader$SoURLLoader *, ::java::net::URL *);
+ ::java::io::InputStream * getInputStream();
+public:
+ jint getLength();
+ ::java::net::URL * getURL();
+public: // actually package-private
+ ::java::net::URL * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$Resource)))) url;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$SoResource__
diff --git a/libjava/java/net/URLClassLoader$SoURLLoader.h b/libjava/java/net/URLClassLoader$SoURLLoader.h
new file mode 100644
index 00000000000..85d2d2e991a
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$SoURLLoader.h
@@ -0,0 +1,47 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$SoURLLoader__
+#define __java_net_URLClassLoader$SoURLLoader__
+
+#pragma interface
+
+#include <java/net/URLClassLoader$URLLoader.h>
+extern "Java"
+{
+ namespace gnu
+ {
+ namespace gcj
+ {
+ namespace runtime
+ {
+ class SharedLibHelper;
+ }
+ }
+ }
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$Resource;
+ class URLClassLoader$SoURLLoader;
+ }
+ }
+}
+
+class java::net::URLClassLoader$SoURLLoader : public ::java::net::URLClassLoader$URLLoader
+{
+
+public: // actually package-private
+ URLClassLoader$SoURLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
+ URLClassLoader$SoURLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
+ ::java::lang::Class * getClass(::java::lang::String *);
+ ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *);
+ ::gnu::gcj::runtime::SharedLibHelper * __attribute__((aligned(__alignof__( ::java::net::URLClassLoader$URLLoader)))) helper;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$SoURLLoader__
diff --git a/libjava/java/net/URLClassLoader$URLLoader.h b/libjava/java/net/URLClassLoader$URLLoader.h
new file mode 100644
index 00000000000..f205d74b3db
--- /dev/null
+++ b/libjava/java/net/URLClassLoader$URLLoader.h
@@ -0,0 +1,45 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader$URLLoader__
+#define __java_net_URLClassLoader$URLLoader__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$Resource;
+ class URLClassLoader$URLLoader;
+ }
+ namespace security
+ {
+ class CodeSource;
+ }
+ }
+}
+
+class java::net::URLClassLoader$URLLoader : public ::java::lang::Object
+{
+
+public: // actually package-private
+ URLClassLoader$URLLoader(::java::net::URLClassLoader *, ::java::net::URL *);
+ URLClassLoader$URLLoader(::java::net::URLClassLoader *, ::java::net::URL *, ::java::net::URL *);
+ virtual ::java::lang::Class * getClass(::java::lang::String *);
+ virtual ::java::net::URLClassLoader$Resource * getResource(::java::lang::String *) = 0;
+ virtual ::java::util::jar::Manifest * getManifest();
+ virtual ::java::util::Vector * getClassPath();
+ ::java::net::URLClassLoader * __attribute__((aligned(__alignof__( ::java::lang::Object)))) classloader;
+ ::java::net::URL * baseURL;
+ ::java::security::CodeSource * noCertCodeSource;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader$URLLoader__
diff --git a/libjava/java/net/URLClassLoader.h b/libjava/java/net/URLClassLoader.h
new file mode 100644
index 00000000000..25fe59ab785
--- /dev/null
+++ b/libjava/java/net/URLClassLoader.h
@@ -0,0 +1,82 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLClassLoader__
+#define __java_net_URLClassLoader__
+
+#pragma interface
+
+#include <java/security/SecureClassLoader.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URL;
+ class URLClassLoader;
+ class URLClassLoader$Resource;
+ class URLStreamHandler;
+ class URLStreamHandlerFactory;
+ }
+ namespace security
+ {
+ class AccessControlContext;
+ class CodeSource;
+ class PermissionCollection;
+ }
+ }
+}
+
+class java::net::URLClassLoader : public ::java::security::SecureClassLoader
+{
+
+public:
+ URLClassLoader(JArray< ::java::net::URL * > *);
+ URLClassLoader(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *);
+public: // actually package-private
+ URLClassLoader(::java::lang::ClassLoader *, ::java::security::AccessControlContext *);
+public:
+ URLClassLoader(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *, ::java::net::URLStreamHandlerFactory *);
+public: // actually protected
+ virtual void addURL(::java::net::URL *);
+private:
+ void addURLImpl(::java::net::URL *);
+ void addURLs(JArray< ::java::net::URL * > *);
+ ::java::lang::String * getAttributeValue(::java::util::jar::Attributes$Name *, ::java::util::jar::Attributes *, ::java::util::jar::Attributes *);
+public: // actually protected
+ virtual ::java::lang::Package * definePackage(::java::lang::String *, ::java::util::jar::Manifest *, ::java::net::URL *);
+ virtual ::java::lang::Class * findClass(::java::lang::String *);
+public:
+ virtual ::java::lang::String * toString();
+private:
+ ::java::net::URLClassLoader$Resource * findURLResource(::java::lang::String *);
+public:
+ virtual ::java::net::URL * findResource(::java::lang::String *);
+public: // actually package-private
+ virtual ::java::net::URLStreamHandler * getURLStreamHandler(::java::lang::String *);
+public:
+ virtual ::java::util::Enumeration * findResources(::java::lang::String *);
+public: // actually protected
+ virtual ::java::security::PermissionCollection * getPermissions(::java::security::CodeSource *);
+public:
+ virtual JArray< ::java::net::URL * > * getURLs();
+ static ::java::net::URLClassLoader * newInstance(JArray< ::java::net::URL * > *);
+ static ::java::net::URLClassLoader * newInstance(JArray< ::java::net::URL * > *, ::java::lang::ClassLoader *);
+public: // actually package-private
+ static ::java::lang::Class * access$0(::java::net::URLClassLoader *, ::java::lang::String *, JArray< jbyte > *, jint, jint, ::java::security::CodeSource *);
+private:
+ static ::java::util::HashMap * urlloaders;
+ static ::java::util::HashMap * factoryCache;
+ ::java::util::Vector * __attribute__((aligned(__alignof__( ::java::security::SecureClassLoader)))) urls;
+ ::java::util::Vector * urlinfos;
+ ::java::net::URLStreamHandlerFactory * factory;
+ ::java::security::AccessControlContext * securityContext;
+ ::java::lang::String * thisString;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLClassLoader__
diff --git a/libjava/java/net/URLClassLoader.java b/libjava/java/net/URLClassLoader.java
index 06db7d58217..fd70fdf2045 100644
--- a/libjava/java/net/URLClassLoader.java
+++ b/libjava/java/net/URLClassLoader.java
@@ -1080,7 +1080,10 @@ public class URLClassLoader extends SecureClassLoader
if (resource == null)
{
String message = className + " not found";
- if (runtimeInitialized())
+ // Calling this.toString() during VM startup when a
+ // security manager is in force causes the stack to
+ // be unwound before it can properly be decoded.
+ if (Thread.currentThread() != null)
message += " in " + this;
throw new ClassNotFoundException(message);
}
@@ -1442,11 +1445,4 @@ public class URLClassLoader extends SecureClassLoader
return loader;
}
}
-
- /**
- * Tell whether runtime initialization is complete.
- *
- * @return whether runtime initialization is complete.
- */
- private static native boolean runtimeInitialized();
}
diff --git a/libjava/java/net/URLConnection.h b/libjava/java/net/URLConnection.h
new file mode 100644
index 00000000000..c40d9598b9d
--- /dev/null
+++ b/libjava/java/net/URLConnection.h
@@ -0,0 +1,117 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLConnection__
+#define __java_net_URLConnection__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class ContentHandler;
+ class ContentHandlerFactory;
+ class FileNameMap;
+ class URL;
+ class URLConnection;
+ }
+ namespace security
+ {
+ class Permission;
+ }
+ namespace text
+ {
+ class ParsePosition;
+ class SimpleDateFormat;
+ }
+ }
+}
+
+class java::net::URLConnection : public ::java::lang::Object
+{
+
+public: // actually protected
+ URLConnection(::java::net::URL *);
+public:
+ virtual void connect() = 0;
+ virtual ::java::net::URL * getURL();
+ virtual jint getConnectTimeout();
+ virtual void setConnectTimeout(jint);
+ virtual jint getReadTimeout();
+ virtual void setReadTimeout(jint);
+ virtual jint getContentLength();
+ virtual ::java::lang::String * getContentType();
+ virtual ::java::lang::String * getContentEncoding();
+ virtual jlong getExpiration();
+ virtual jlong getDate();
+ virtual jlong getLastModified();
+ virtual ::java::lang::String * getHeaderField(jint);
+ virtual ::java::lang::String * getHeaderField(::java::lang::String *);
+ virtual ::java::util::Map * getHeaderFields();
+ virtual jint getHeaderFieldInt(::java::lang::String *, jint);
+ virtual jlong getHeaderFieldDate(::java::lang::String *, jlong);
+ virtual ::java::lang::String * getHeaderFieldKey(jint);
+ virtual ::java::lang::Object * getContent();
+ virtual ::java::lang::Object * getContent(JArray< ::java::lang::Class * > *);
+ virtual ::java::security::Permission * getPermission();
+ virtual ::java::io::InputStream * getInputStream();
+ virtual ::java::io::OutputStream * getOutputStream();
+ virtual ::java::lang::String * toString();
+ virtual void setDoInput(jboolean);
+ virtual jboolean getDoInput();
+ virtual void setDoOutput(jboolean);
+ virtual jboolean getDoOutput();
+ virtual void setAllowUserInteraction(jboolean);
+ virtual jboolean getAllowUserInteraction();
+ static void setDefaultAllowUserInteraction(jboolean);
+ static jboolean getDefaultAllowUserInteraction();
+ virtual void setUseCaches(jboolean);
+ virtual jboolean getUseCaches();
+ virtual void setIfModifiedSince(jlong);
+ virtual jlong getIfModifiedSince();
+ virtual jboolean getDefaultUseCaches();
+ virtual void setDefaultUseCaches(jboolean);
+ virtual void setRequestProperty(::java::lang::String *, ::java::lang::String *);
+ virtual void addRequestProperty(::java::lang::String *, ::java::lang::String *);
+ virtual ::java::lang::String * getRequestProperty(::java::lang::String *);
+ virtual ::java::util::Map * getRequestProperties();
+ static void setDefaultRequestProperty(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::String * getDefaultRequestProperty(::java::lang::String *);
+ static void setContentHandlerFactory(::java::net::ContentHandlerFactory *);
+ static ::java::lang::String * guessContentTypeFromName(::java::lang::String *);
+ static ::java::lang::String * guessContentTypeFromStream(::java::io::InputStream *);
+ static ::java::net::FileNameMap * getFileNameMap();
+ static void setFileNameMap(::java::net::FileNameMap *);
+private:
+ ::java::net::ContentHandler * getContentHandler(::java::lang::String *);
+ static void initializeDateFormats();
+ static ::java::net::FileNameMap * fileNameMap;
+ static ::java::net::ContentHandlerFactory * factory;
+ static jboolean defaultAllowUserInteraction;
+ static jboolean defaultUseCaches;
+ static ::java::net::ContentHandlerFactory * defaultFactory;
+public: // actually protected
+ jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) allowUserInteraction;
+ jboolean connected;
+ jboolean doInput;
+ jboolean doOutput;
+ jboolean useCaches;
+ jlong ifModifiedSince;
+ ::java::net::URL * url;
+private:
+ static JArray< ::java::text::SimpleDateFormat * > * dateFormats;
+ static jboolean dateformats_initialized;
+ jint connectTimeout;
+ jint readTimeout;
+ ::java::text::ParsePosition * position;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLConnection__
diff --git a/libjava/java/net/URLDecoder.h b/libjava/java/net/URLDecoder.h
new file mode 100644
index 00000000000..a6586cf741a
--- /dev/null
+++ b/libjava/java/net/URLDecoder.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLDecoder__
+#define __java_net_URLDecoder__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URLDecoder;
+ }
+ }
+}
+
+class java::net::URLDecoder : public ::java::lang::Object
+{
+
+public:
+ URLDecoder();
+ static ::java::lang::String * decode(::java::lang::String *);
+ static ::java::lang::String * decode(::java::lang::String *, ::java::lang::String *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLDecoder__
diff --git a/libjava/java/net/URLEncoder.h b/libjava/java/net/URLEncoder.h
new file mode 100644
index 00000000000..87b3c574f78
--- /dev/null
+++ b/libjava/java/net/URLEncoder.h
@@ -0,0 +1,35 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLEncoder__
+#define __java_net_URLEncoder__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URLEncoder;
+ }
+ }
+}
+
+class java::net::URLEncoder : public ::java::lang::Object
+{
+
+public:
+ static ::java::lang::String * encode(::java::lang::String *);
+ static ::java::lang::String * encode(::java::lang::String *, ::java::lang::String *);
+private:
+ static jboolean isSafe(jchar);
+ URLEncoder();
+ static ::java::lang::String * hex;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLEncoder__
diff --git a/libjava/java/net/URLStreamHandler.h b/libjava/java/net/URLStreamHandler.h
new file mode 100644
index 00000000000..ebcd44159c2
--- /dev/null
+++ b/libjava/java/net/URLStreamHandler.h
@@ -0,0 +1,48 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLStreamHandler__
+#define __java_net_URLStreamHandler__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class InetAddress;
+ class URL;
+ class URLConnection;
+ class URLStreamHandler;
+ }
+ }
+}
+
+class java::net::URLStreamHandler : public ::java::lang::Object
+{
+
+public:
+ URLStreamHandler();
+public: // actually protected
+ virtual ::java::net::URLConnection * openConnection(::java::net::URL *) = 0;
+ virtual void parseURL(::java::net::URL *, ::java::lang::String *, jint, jint);
+private:
+ static ::java::lang::String * canonicalizeFilename(::java::lang::String *);
+public: // actually protected
+ virtual jboolean sameFile(::java::net::URL *, ::java::net::URL *);
+ virtual void setURL(::java::net::URL *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *);
+ virtual void setURL(::java::net::URL *, ::java::lang::String *, ::java::lang::String *, jint, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *, ::java::lang::String *);
+ virtual jboolean equals(::java::net::URL *, ::java::net::URL *);
+ virtual jboolean hostsEqual(::java::net::URL *, ::java::net::URL *);
+ virtual ::java::net::InetAddress * getHostAddress(::java::net::URL *);
+ virtual jint getDefaultPort();
+ virtual jint hashCode(::java::net::URL *);
+ virtual ::java::lang::String * toExternalForm(::java::net::URL *);
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_URLStreamHandler__
diff --git a/libjava/java/net/URLStreamHandlerFactory.h b/libjava/java/net/URLStreamHandlerFactory.h
new file mode 100644
index 00000000000..dde45e239a2
--- /dev/null
+++ b/libjava/java/net/URLStreamHandlerFactory.h
@@ -0,0 +1,30 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_URLStreamHandlerFactory__
+#define __java_net_URLStreamHandlerFactory__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class URLStreamHandler;
+ class URLStreamHandlerFactory;
+ }
+ }
+}
+
+class java::net::URLStreamHandlerFactory : public ::java::lang::Object
+{
+
+public:
+ virtual ::java::net::URLStreamHandler * createURLStreamHandler(::java::lang::String *) = 0;
+ static ::java::lang::Class class$;
+} __attribute__ ((java_interface));
+
+#endif // __java_net_URLStreamHandlerFactory__
diff --git a/libjava/java/net/UnknownHostException.h b/libjava/java/net/UnknownHostException.h
new file mode 100644
index 00000000000..965d439f3bf
--- /dev/null
+++ b/libjava/java/net/UnknownHostException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_UnknownHostException__
+#define __java_net_UnknownHostException__
+
+#pragma interface
+
+#include <java/io/IOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class UnknownHostException;
+ }
+ }
+}
+
+class java::net::UnknownHostException : public ::java::io::IOException
+{
+
+public:
+ UnknownHostException();
+ UnknownHostException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4639126076052875403LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_UnknownHostException__
diff --git a/libjava/java/net/UnknownServiceException.h b/libjava/java/net/UnknownServiceException.h
new file mode 100644
index 00000000000..1bdc8021c3d
--- /dev/null
+++ b/libjava/java/net/UnknownServiceException.h
@@ -0,0 +1,33 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_UnknownServiceException__
+#define __java_net_UnknownServiceException__
+
+#pragma interface
+
+#include <java/io/IOException.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class UnknownServiceException;
+ }
+ }
+}
+
+class java::net::UnknownServiceException : public ::java::io::IOException
+{
+
+public:
+ UnknownServiceException();
+ UnknownServiceException(::java::lang::String *);
+private:
+ static const jlong serialVersionUID = -4169033248853639508LL;
+public:
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_UnknownServiceException__
diff --git a/libjava/java/net/VMInetAddress.h b/libjava/java/net/VMInetAddress.h
new file mode 100644
index 00000000000..e093e2c2e9c
--- /dev/null
+++ b/libjava/java/net/VMInetAddress.h
@@ -0,0 +1,37 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_VMInetAddress__
+#define __java_net_VMInetAddress__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class VMInetAddress;
+ }
+ }
+}
+
+class java::net::VMInetAddress : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMInetAddress();
+public:
+ static ::java::lang::String * getLocalHostname();
+ static JArray< jbyte > * lookupInaddrAny();
+ static ::java::lang::String * getHostByAddr(JArray< jbyte > *);
+ static JArray< JArray< jbyte > * > * getHostByName(::java::lang::String *);
+ static JArray< jbyte > * aton(::java::lang::String *);
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_VMInetAddress__
diff --git a/libjava/java/net/VMNetworkInterface.h b/libjava/java/net/VMNetworkInterface.h
new file mode 100644
index 00000000000..792c5337a57
--- /dev/null
+++ b/libjava/java/net/VMNetworkInterface.h
@@ -0,0 +1,31 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_VMNetworkInterface__
+#define __java_net_VMNetworkInterface__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class VMNetworkInterface;
+ }
+ }
+}
+
+class java::net::VMNetworkInterface : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMNetworkInterface();
+public:
+ static ::java::util::Vector * getInterfaces();
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_VMNetworkInterface__
diff --git a/libjava/java/net/VMURLConnection.h b/libjava/java/net/VMURLConnection.h
new file mode 100644
index 00000000000..0c0828ae457
--- /dev/null
+++ b/libjava/java/net/VMURLConnection.h
@@ -0,0 +1,38 @@
+
+// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
+
+#ifndef __java_net_VMURLConnection__
+#define __java_net_VMURLConnection__
+
+#pragma interface
+
+#include <java/lang/Object.h>
+#include <gcj/array.h>
+
+extern "Java"
+{
+ namespace java
+ {
+ namespace net
+ {
+ class VMURLConnection;
+ }
+ }
+}
+
+class java::net::VMURLConnection : public ::java::lang::Object
+{
+
+public: // actually package-private
+ VMURLConnection();
+private:
+ static void init();
+ static ::java::lang::String * guessContentTypeFromBuffer(JArray< jbyte > *, jint);
+public: // actually package-private
+ static ::java::lang::String * guessContentTypeFromStream(::java::io::InputStream *);
+public:
+ static const jint LENGTH = 1024;
+ static ::java::lang::Class class$;
+};
+
+#endif // __java_net_VMURLConnection__
diff --git a/libjava/java/net/VMURLConnection.java b/libjava/java/net/VMURLConnection.java
index 6555e8cbafe..19bf5814e67 100644
--- a/libjava/java/net/VMURLConnection.java
+++ b/libjava/java/net/VMURLConnection.java
@@ -47,14 +47,17 @@ final class VMURLConnection
{
public static final int LENGTH = 1024;
- // private static native void init();
-
- private static String guessContentTypeFromBuffer(byte[] b, int valid)
+ static
{
- // FIXME - write real implementation
- return null;
+ if (Configuration.INIT_LOAD_LIBRARY)
+ System.loadLibrary("javanet");
+ init();
}
+ private static native void init();
+
+ private static native String guessContentTypeFromBuffer(byte[] b, int valid);
+
/**
* This is called from URLConnection to guess the mime type of a
* stream. This method may return null to indicate that it could
diff --git a/libjava/java/net/natURLClassLoader.cc b/libjava/java/net/natURLClassLoader.cc
deleted file mode 100644
index ead0db44aff..00000000000
--- a/libjava/java/net/natURLClassLoader.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// natURLClassLoader.cc -- Native part of the URLClassLoader class.
-
-/* Copyright (C) 2006 Free Software Foundation, Inc.
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#include <config.h>
-
-#include <gcj/cni.h>
-#include <jvm.h>
-
-#include <java/net/URLClassLoader.h>
-
-jboolean
-java::net::URLClassLoader::runtimeInitialized ()
-{
- return gcj::runtimeInitialized;
-}
diff --git a/libjava/java/net/natVMURLConnection.cc b/libjava/java/net/natVMURLConnection.cc
new file mode 100644
index 00000000000..3429bb63dba
--- /dev/null
+++ b/libjava/java/net/natVMURLConnection.cc
@@ -0,0 +1,56 @@
+/* Copyright (C) 2006 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+#include <config.h>
+
+#include <java/net/VMURLConnection.h>
+#include <gcj/cni.h>
+#include <java/lang/UnsupportedOperationException.h>
+
+#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
+
+#include <magic.h>
+
+static magic_t cookie;
+
+#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
+
+void
+java::net::VMURLConnection::init ()
+{
+#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
+ cookie = magic_open (MAGIC_MIME);
+ if (cookie == (magic_t) NULL)
+ return;
+ if (magic_load (cookie, NULL) == -1)
+ {
+ magic_close (cookie);
+ cookie = (magic_t) NULL;
+ }
+#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
+}
+
+::java::lang::String *
+java::net::VMURLConnection::guessContentTypeFromBuffer (jbyteArray bytes,
+ jint valid)
+{
+#if defined (HAVE_MAGIC_H) && defined (HAVE_MAGIC_OPEN)
+ const char *result;
+
+ if (cookie == (magic_t) NULL)
+ return NULL;
+
+ result = magic_buffer (cookie, elements(bytes), valid);
+
+ if (result == NULL)
+ return NULL;
+ return _Jv_NewStringUTF (result);
+#else
+ return NULL;
+#endif /* HAVE_MAGIC_H && HAVE_MAGIC_OPEN */
+}