summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/vm/reference
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-17 18:09:40 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-17 18:09:40 +0000
commit2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede (patch)
treec976ca91e3ef0bda3b34b37c0195145638d8d08e /libjava/classpath/vm/reference
parenta3ef37ddfeddcc5b0f1c5068d8fdeb25a302d5cd (diff)
downloadppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.tar.gz
ppe42-gcc-2d8cf20d0d5ca6b1fbdefc22229d4b7cf1497ede.zip
Imported GNU Classpath 0.20
* Makefile.am (AM_CPPFLAGS): Add classpath/include. * java/nio/charset/spi/CharsetProvider.java: New override file. * java/security/Security.java: Likewise. * sources.am: Regenerated. * Makefile.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@109831 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/vm/reference')
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java57
-rw-r--r--libjava/classpath/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java260
-rw-r--r--libjava/classpath/vm/reference/gnu/java/net/VMPlainSocketImpl.java314
3 files changed, 613 insertions, 18 deletions
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
index 30826b7b1a4..aa285cb58a6 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMVirtualMachine.java
@@ -42,6 +42,7 @@ exception statement from your version. */
package gnu.classpath.jdwp;
import gnu.classpath.jdwp.event.EventRequest;
+import gnu.classpath.jdwp.exception.JdwpException;
import gnu.classpath.jdwp.exception.InvalidClassException;
import gnu.classpath.jdwp.exception.InvalidObjectException;
import gnu.classpath.jdwp.id.ObjectId;
@@ -68,12 +69,14 @@ public class VMVirtualMachine
*
* @param thread the thread to suspend
*/
- public static native void suspendThread (Thread thread);
+ public static native void suspendThread (Thread thread)
+ throws JdwpException;
/**
* Suspend all threads
*/
public static void suspendAllThreads ()
+ throws JdwpException
{
// Our JDWP thread group -- don't suspend any of those threads
Thread current = Thread.currentThread ();
@@ -118,7 +121,8 @@ public class VMVirtualMachine
*
* @param thread the thread to resume
*/
- public static native void resumeThread (Thread thread);
+ public static native void resumeThread (Thread thread)
+ throws JdwpException;
/**
* Resume all threads. This simply decrements the thread's
@@ -126,6 +130,7 @@ public class VMVirtualMachine
* to run.
*/
public static void resumeAllThreads ()
+ throws JdwpException
{
// Our JDWP thread group -- don't resume
Thread current = Thread.currentThread ();
@@ -167,17 +172,20 @@ public class VMVirtualMachine
* @param thread the thread whose suspend count is desired
* @return the number of times the thread has been suspended
*/
- public static native int getSuspendCount (Thread thread);
+ public static native int getSuspendCount (Thread thread)
+ throws JdwpException;
/**
* Returns a count of the number of loaded classes in the VM
*/
- public static native int getAllLoadedClassesCount ();
+ public static native int getAllLoadedClassesCount ()
+ throws JdwpException;
/**
* Returns an iterator over all the loaded classes in the VM
*/
- public static native Iterator getAllLoadedClasses ();
+ public static native Iterator getAllLoadedClasses ()
+ throws JdwpException;
/**
* Returns the status of the given class
@@ -186,7 +194,8 @@ public class VMVirtualMachine
* @return a flag containing the class's status
* @see JdwpConstants.ClassStatus
*/
- public static native int getClassStatus (Class clazz);
+ public static native int getClassStatus (Class clazz)
+ throws JdwpException;
/**
@@ -198,7 +207,8 @@ public class VMVirtualMachine
* @return a list of frames
*/
public static native ArrayList getFrames (Thread thread, int strart,
- int length);
+ int length)
+ throws JdwpException;
/**
* Returns the frame for a given thread with the frame ID in
@@ -210,7 +220,8 @@ public class VMVirtualMachine
* @param bb buffer containing the frame's ID
* @return the desired frame
*/
- public static native VMFrame getFrame (Thread thread, ByteBuffer bb);
+ public static native VMFrame getFrame (Thread thread, ByteBuffer bb)
+ throws JdwpException;
/**
* Returns the number of frames in the thread's stack
@@ -218,7 +229,8 @@ public class VMVirtualMachine
* @param thread the thread for which to get a frame count
* @return the number of frames in the thread's stack
*/
- public static native int getFrameCount (Thread thread);
+ public static native int getFrameCount (Thread thread)
+ throws JdwpException;
/**
@@ -228,7 +240,8 @@ public class VMVirtualMachine
* @return integer status of the thread
* @see JdwpConstants.ThreadStatus
*/
- public static native int getThreadStatus (Thread thread);
+ public static native int getThreadStatus (Thread thread)
+ throws JdwpException;
/**
* Returns a list of all classes which this class loader has been
@@ -237,7 +250,8 @@ public class VMVirtualMachine
* @param cl the class loader
* @return a list of all visible classes
*/
- public static native ArrayList getLoadRequests (ClassLoader cl);
+ public static native ArrayList getLoadRequests (ClassLoader cl)
+ throws JdwpException;
/**
* Executes a method in the virtual machine
@@ -254,7 +268,8 @@ public class VMVirtualMachine
public static native MethodResult executeMethod (Object obj, Thread thread,
Class clazz, Method method,
Object[] values,
- boolean nonVirtual);
+ boolean nonVirtual)
+ throws JdwpException;
/**
* "Returns variable information for the method. The variable table
@@ -266,7 +281,8 @@ public class VMVirtualMachine
* @param method the method for which variable information is desired
* @return a result object containing the information
*/
- public static native VariableTable getVarTable (Class clazz, Method method);
+ public static native VariableTable getVarTable (Class clazz, Method method)
+ throws JdwpException;
/**
* "Returns line number information for the method, if present. The line
@@ -279,7 +295,8 @@ public class VMVirtualMachine
* @param method the method whose line table is desired
* @return a result object containing the line table
*/
- public static native LineTable getLineTable (Class clazz, Method method);
+ public static native LineTable getLineTable (Class clazz, Method method)
+ throws JdwpException;
/**
* "Returns the name of source file in which a reference type was declared"
@@ -288,7 +305,8 @@ public class VMVirtualMachine
* @return a string containing the source file name; "no path information
* for the file is included"
*/
- public static native String getSourceFile (Class clazz);
+ public static native String getSourceFile (Class clazz)
+ throws JdwpException;
/**
* Register a request from the debugger
@@ -299,14 +317,16 @@ public class VMVirtualMachine
* or do some internal work to set up the event notification (useful for
* execution-related events like breakpoints, single-stepping, etc.).
*/
- public static native void registerEvent (EventRequest request);
+ public static native void registerEvent (EventRequest request)
+ throws JdwpException;
/**
* Unregisters the given request
*
* @param request the request to unregister
*/
- public static native void unregisterEvent (EventRequest request);
+ public static native void unregisterEvent (EventRequest request)
+ throws JdwpException;
/**
@@ -314,5 +334,6 @@ public class VMVirtualMachine
*
* @param kind the type of events to clear
*/
- public static native void clearEvents (byte kind);
+ public static native void clearEvents (byte kind)
+ throws JdwpException;
}
diff --git a/libjava/classpath/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java b/libjava/classpath/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
new file mode 100644
index 00000000000..958c2187412
--- /dev/null
+++ b/libjava/classpath/vm/reference/gnu/java/net/VMPlainDatagramSocketImpl.java
@@ -0,0 +1,260 @@
+/* PlainDatagramSocketImpl.java -- VM interface for DatagramSocket impl
+ Copyright (C) 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 gnu.java.net;
+
+import gnu.classpath.Configuration;
+
+import java.io.IOException;
+import java.net.DatagramPacket;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.net.SocketAddress;
+import java.net.SocketException;
+
+/**
+ * The VM interface for {@link gnu.java.net.PlainDatagramSocketImpl}.
+ *
+ * @author Ingo Proetel (proetel@aicas.com)
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public final class VMPlainDatagramSocketImpl
+{
+ /**
+ * Option id for the IP_TTL (time to live) value.
+ */
+ static final int IP_TTL = 0x1E61; // 7777
+
+
+ // Static initializer to load native library
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javanet");
+ }
+ }
+
+ /**
+ * Binds this socket to a particular port and interface
+ *
+ * @param socket the socket object
+ * @param port the port to bind to
+ * @param addr the address to bind to
+ *
+ * @throws SocketException If an error occurs
+ */
+ static native void bind(PlainDatagramSocketImpl socket, int port,
+ InetAddress addr)
+ throws SocketException;
+
+ /**
+ * Creates a new datagram socket.
+ *
+ * @param socket the socket object
+ *
+ * @throws SocketException If an error occurs
+ */
+ static native void create(PlainDatagramSocketImpl socket)
+ throws SocketException;
+
+ /**
+ * Connects to the remote address and port specified as arguments.
+ *
+ * @param socket the socket object
+ * @param addr the remote address to connect to
+ * @param port the remote port to connect to
+ *
+ * @throws SocketException If an error occurs
+ */
+ static native void connect(PlainDatagramSocketImpl socket, InetAddress addr,
+ int port)
+ throws SocketException;
+
+ /**
+ * Sends a packet of data to a remote host.
+ *
+ * @param socket the socket object
+ * @param packet the packet to send
+ *
+ * @throws IOException If an error occurs
+ */
+ static void send(PlainDatagramSocketImpl socket, DatagramPacket packet)
+ throws IOException
+ {
+ nativeSendTo(socket, packet.getAddress(), packet.getPort(),
+ packet.getData(), packet.getOffset(), packet.getLength());
+ }
+
+
+ /**
+ * Sends a packet of data to a remote host.
+ *
+ * @param socket the socket object
+ * @param addr the address to send to
+ * @param port the port to send to
+ * @param buf the buffer to send
+ * @param offset the offset of the data in the buffer to send
+ * @param len the length of the data to send
+ *
+ * @throws IOException If an error occurs
+ */
+ private static native void nativeSendTo(PlainDatagramSocketImpl socket,
+ InetAddress addr, int port,
+ byte[] buf, int offset, int len)
+ throws IOException;
+
+ /**
+ * Receives a UDP packet from the network
+ *
+ * @param socket the socket object
+ * @param packet the packet to fill in with the data received
+ *
+ * @throws IOException IOException If an error occurs
+ */
+ static void receive(PlainDatagramSocketImpl socket, DatagramPacket packet)
+ throws IOException
+ {
+ byte[] receiveFromAddress = new byte[4];
+ int[] receiveFromPort = new int[1];
+ int[] receivedLength = new int[1];
+
+ nativeReceive(socket, packet.getData(), packet.getOffset(),
+ packet.getLength(),
+ receiveFromAddress, receiveFromPort, receivedLength);
+
+ packet.setAddress(InetAddress.getByAddress(receiveFromAddress));
+ packet.setPort(receiveFromPort[0]);
+ packet.setLength(receivedLength[0]);
+ }
+
+ private static native void nativeReceive(PlainDatagramSocketImpl socket,
+ byte[] buf, int offset, int len,
+ byte[] receiveFromAddress,
+ int[] receiveFromPort,
+ int[] receivedLength)
+ throws IOException;
+
+ /**
+ * Sets the value of an option on the socket
+ *
+ * @param socket the socket object
+ * @param optionId the identifier of the option to set
+ * @param value the value of the option to set
+ *
+ * @exception SocketException If an error occurs
+ */
+ static native void setOption(PlainDatagramSocketImpl socket, int optionId,
+ Object value)
+ throws SocketException;
+
+ /**
+ * Retrieves the value of an option on the socket.
+ *
+ * @param socket the socket object
+ * @param optionId the identifier of the option to retrieve
+ *
+ * @return the value of the option
+ *
+ * @throws SocketException if an error occurs
+ */
+ static native Object getOption(PlainDatagramSocketImpl socket, int optionId)
+ throws SocketException;
+
+ /**
+ * Closes the socket.
+ *
+ * @param socket the socket object
+ */
+ static native void close(PlainDatagramSocketImpl socket);
+
+ /**
+ * Joins a multicast group
+ *
+ * @param addr The group to join
+ *
+ * @exception IOException If an error occurs
+ */
+ static native void join(PlainDatagramSocketImpl socket, InetAddress addr)
+ throws IOException;
+
+ /**
+ * Leaves a multicast group
+ *
+ * @param addr The group to leave
+ *
+ * @exception IOException If an error occurs
+ */
+ static native void leave(PlainDatagramSocketImpl socket, InetAddress addr)
+ throws IOException;
+
+ /**
+ * Joins a multicast group.
+ *
+ * @param socket the socket object
+ * @param address the socket address
+ * @param netIf the network interface
+ *
+ * @throws IOException if I/O errors occur
+ */
+ static void joinGroup(PlainDatagramSocketImpl socket, SocketAddress address,
+ NetworkInterface netIf)
+ throws IOException
+ {
+ throw new InternalError
+ ("PlainDatagramSocketImpl::joinGroup is not implemented");
+ }
+
+ /**
+ * Leaves a multicast group.
+ *
+ * @param socket the socket object
+ * @param address the socket address
+ * @param netIf the network interface
+ *
+ * @throws IOException if I/O errors occur
+ */
+ static void leaveGroup(PlainDatagramSocketImpl socket, SocketAddress address,
+ NetworkInterface netIf)
+ throws IOException
+ {
+ throw new InternalError
+ ("PlainDatagramSocketImpl::leaveGroup is not implemented");
+ }
+
+}
diff --git a/libjava/classpath/vm/reference/gnu/java/net/VMPlainSocketImpl.java b/libjava/classpath/vm/reference/gnu/java/net/VMPlainSocketImpl.java
new file mode 100644
index 00000000000..76be558dcd4
--- /dev/null
+++ b/libjava/classpath/vm/reference/gnu/java/net/VMPlainSocketImpl.java
@@ -0,0 +1,314 @@
+/* VMPlainSocketImpl.java -- VM interface for default socket implementation
+ Copyright (C) 2005, 2006 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 gnu.java.net;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.net.SocketImpl;
+import java.net.SocketOptions;
+import java.net.UnknownHostException;
+
+import gnu.classpath.Configuration;
+
+/**
+ * The VM interface for {@link gnu.java.net.PlainSocketImpl}.
+ *
+ * @author Ingo Proetel (proetel@aicas.com)
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public final class VMPlainSocketImpl
+{
+ /**
+ * Static initializer to load native library.
+ */
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javanet");
+ }
+ }
+
+ /**
+ * Sets the specified option on a socket to the passed in object.
+ * The optionId parameter is one of the defined constants in
+ * the SocketImpl interface.
+ *
+ * @param socket the socket object
+ * @param optionId the identifier of the option
+ * @param value the value to set the option to
+ *
+ * @throws SocketException if an error occurs
+ */
+ static native void setOption(PlainSocketImpl socket, int optionId, Object value)
+ throws SocketException;
+
+ /**
+ * Returns the current setting of the specified option. The optionId
+ * is one of the defined constants in this interface.
+ *
+ * @param socket the socket object
+ * @param optionId the option identifier
+ *
+ * @return the current value of the option
+ *
+ * @throws SocketException ff an error occurs
+ */
+ static native Object getOption(PlainSocketImpl socket, int optionId)
+ throws SocketException;
+
+ /**
+ * Creates a new socket that is not bound to any local address/port and
+ * is not connected to any remote address/port.
+ *
+ * @param socket the socket object
+ *
+ * @throws IOException if something goes wrong while creating the socket
+ */
+ static native void create(PlainSocketImpl socket) throws IOException;
+
+ /**
+ * Connects to the remote address and port specified as arguments.
+ *
+ * @param socket the socket object
+ * @param addr the remote address to connect to
+ * @param port the remote port to connect to
+ *
+ * @throws IOException if an error occurs
+ */
+ static native void connect(PlainSocketImpl socket, InetAddress addr,
+ int port) throws IOException;
+
+ /**
+ * Binds to the specified port on the specified addr. Note that this addr
+ * must represent a local IP address. **** How bind to INADDR_ANY? ****
+ *
+ * @param socket the socket object
+ * @param addr the address to bind to
+ * @param port the port number to bind to
+ *
+ * @exception IOException If an error occurs
+ */
+ static native void bind(PlainSocketImpl socket, InetAddress addr, int port)
+ throws IOException;
+
+ /**
+ * Starts listening for connections on a socket. The queueLen parameter
+ * is how many pending connections will queue up waiting to be serviced
+ * before being accepted. If the queue of pending requests exceeds this
+ * number, additional connections will be refused.
+ *
+ * @param socket the socket object
+ * @param queueLen the length of the pending connection queue
+ *
+ * @exception IOException if an error occurs
+ */
+ static native void listen(PlainSocketImpl socket, int queueLen)
+ throws IOException;
+
+ /**
+ * Accepts a new connection on this socket.
+ *
+ * @param socket the socket object
+ * @param impl the socket object to accept this connection.
+ */
+ static native void accept(PlainSocketImpl socket, SocketImpl impl)
+ throws IOException;
+
+ /**
+ * Returns the number of bytes that the caller can read from this socket
+ * without blocking.
+ *
+ * @param socket the socket object
+ *
+ * @return the number of readable bytes before blocking
+ *
+ * @throws IOException If an error occurs
+ */
+ static native int available(PlainSocketImpl socket) throws IOException;
+
+ /**
+ * Closes the socket. This will cause any InputStream or OutputStream
+ * objects for this Socket to be closed as well.
+ *
+ * <p>
+ * Note that if the SO_LINGER option is set on this socket, then the
+ * operation could block.
+ * </p>
+ *
+ * @param socket the socket object
+ *
+ * @throws IOException if an error occurs
+ */
+ static native void close(PlainSocketImpl socket) throws IOException;
+
+ /**
+ * Internal method used by SocketInputStream for reading data from
+ * the connection. Reads up to len bytes of data into the buffer
+ * buf starting at offset bytes into the buffer.
+ *
+ * @param socket the socket object
+ *
+ * @return the actual number of bytes read or -1 if end of stream.
+ *
+ * @throws IOException if an error occurs
+ */
+ static native int read(PlainSocketImpl socket, byte[] buf, int offset,
+ int len) throws IOException;
+
+ /**
+ * Internal method used by SocketInputStream for reading data from
+ * the connection. Reads and returns one byte of data.
+ *
+ * @param socket the socket object
+ *
+ * @return read byte or -1 if end of stream.
+ *
+ * @throws IOException if an error occurs
+ */
+ static int read(PlainSocketImpl socket) throws IOException
+ {
+ byte[] buf = new byte[1];
+ if (read(socket, buf, 0, 1) > 0)
+ return buf[0] & 0xFF;
+ else
+ return -1;
+ }
+
+ /**
+ * Internal method used by SocketOuputStream for writing data to
+ * the connection. Writes up to len bytes of data from the buffer
+ * <code>buf</code> starting at <cod>offset</code> bytes into the buffer.
+ *
+ * @param socket the socket object
+ * @param buf the buffer to write to the stream
+ * @param offset the start offset in the buffer
+ * @param len the number of bytes to write
+ *
+ * @throws IOException if an error occurs
+ */
+ static native void write(PlainSocketImpl socket, byte[] buf, int offset,
+ int len) throws IOException;
+
+ /**
+ * Internal method used by SocketOuputStream for writing data to
+ * the connection. Writes exactly one byte to the socket.
+ *
+ * @param socket the socket object
+ * @param data the byte to write to the socket
+ *
+ * @throws IOException if an error occurs
+ */
+ static void write(PlainSocketImpl socket, int data)
+ throws IOException
+ {
+ write(socket, new byte[]{ (byte) data }, 0, 1);
+ }
+
+ /**
+ * Sets the input stream for this socket to the end of the stream. Any
+ * attempts to read more bytes from the stream will return an EOF.
+ *
+ * @param socket the socket object
+ *
+ * @throws IOException if I/O errors occur
+ */
+ static native void shutdownInput(PlainSocketImpl socket) throws IOException;
+
+ /**
+ * Disables the output stream for this socket. Any attempt to write more
+ * data to the socket will throw an IOException.
+ *
+ * @param socket the socket object
+ *
+ * @throws IOException if I/O errors occur
+ */
+ static native void shutdownOutput(PlainSocketImpl socket) throws IOException;
+
+ /**
+ * Connects to the remote socket address with a specified timeout.
+ *
+ * @param socket the socket object
+ * @param address the remote address to connect to
+ * @param timeout the timeout to use for this connect, 0 means infinite.
+ *
+ * @throws IOException if an error occurs
+ */
+ static synchronized void connect(PlainSocketImpl socket,
+ SocketAddress address, int timeout)
+ throws IOException
+ {
+ InetSocketAddress sockAddr = (InetSocketAddress) address;
+ InetAddress addr = sockAddr.getAddress();
+
+ if (addr == null)
+ throw new UnknownHostException(sockAddr.getHostName());
+
+ int port = sockAddr.getPort();
+
+ if (timeout < 0)
+ throw new IllegalArgumentException("negative timeout");
+
+ Object oldTimeoutObj = null;
+ try
+ {
+ oldTimeoutObj = getOption(socket, SocketOptions.SO_TIMEOUT);
+ setOption(socket, SocketOptions.SO_TIMEOUT, new Integer(timeout));
+ connect(socket, addr, port);
+ }
+ finally
+ {
+ if (oldTimeoutObj != null)
+ setOption(socket, SocketOptions.SO_TIMEOUT, oldTimeoutObj);
+ }
+ }
+
+ /**
+ * Send one byte of urgent data over the socket.
+ *
+ * @param socket the socket object
+ * @param data the byte to send
+ */
+ static void sendUrgendData(PlainSocketImpl socket, int data)
+ {
+ throw new InternalError ("PlainSocketImpl::sendUrgentData not implemented");
+ }
+}
OpenPOWER on IntegriCloud