Index: gnu/java/net/PlainSocketImpl.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/net/PlainSocketImpl.java,v
retrieving revision 1.9
diff -u -r1.9 PlainSocketImpl.java
--- gnu/java/net/PlainSocketImpl.java 4 Jan 2005 23:36:00 -0000 1.9
+++ gnu/java/net/PlainSocketImpl.java 12 Jan 2005 08:12:13 -0000
@@ -177,15 +177,21 @@
*/
public native Object getOption(int optID) throws SocketException;
- public void shutdownInput()
- {
- throw new InternalError ("PlainSocketImpl::shutdownInput not implemented");
- }
+ /**
+ * Flushes the input stream and closes it. If you read from the input stream
+ * after calling this method a IOException
will be thrown.
+ *
+ * @throws IOException if an error occurs
+ */
+ public native void shutdownInput() throws IOException;
- public void shutdownOutput()
- {
- throw new InternalError ("PlainSocketImpl::shutdownOutput not implemented");
- }
+ /**
+ * Flushes the output stream and closes it. If you write to the output stream
+ * after calling this method a IOException
will be thrown.
+ *
+ * @throws IOException if an error occurs
+ */
+ public native void shutdownOutput() throws IOException;
/**
* Creates a new socket that is not bound to any local address/port and
Index: include/gnu_java_net_PlainSocketImpl.h
===================================================================
RCS file: /cvsroot/classpath/classpath/include/gnu_java_net_PlainSocketImpl.h,v
retrieving revision 1.3
diff -u -r1.3 gnu_java_net_PlainSocketImpl.h
--- include/gnu_java_net_PlainSocketImpl.h 28 May 2004 17:27:53 -0000 1.3
+++ include/gnu_java_net_PlainSocketImpl.h 12 Jan 2005 08:12:13 -0000
@@ -12,6 +12,8 @@
JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_setOption (JNIEnv *env, jobject, jint, jobject);
JNIEXPORT jobject JNICALL Java_gnu_java_net_PlainSocketImpl_getOption (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_shutdownInput (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_shutdownOutput (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_create (JNIEnv *env, jobject, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_connect (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_net_PlainSocketImpl_bind (JNIEnv *env, jobject, jobject, jint);
Index: native/jni/java-net/gnu_java_net_PlainSocketImpl.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/gnu_java_net_PlainSocketImpl.c,v
retrieving revision 1.4
diff -u -r1.4 gnu_java_net_PlainSocketImpl.c
--- native/jni/java-net/gnu_java_net_PlainSocketImpl.c 4 Nov 2004 12:53:22 -0000 1.4
+++ native/jni/java-net/gnu_java_net_PlainSocketImpl.c 12 Jan 2005 08:12:13 -0000
@@ -1,5 +1,5 @@
/* PlainSocketImpl.c - Native methods for PlainSocketImpl class
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -289,4 +289,28 @@
#endif /* not WITHOUT_NETWORK */
}
+JNIEXPORT void JNICALL
+Java_gnu_java_net_PlainSocketImpl_shutdownInput (JNIEnv *env, jobject this)
+{
+#ifndef WITHOUT_NETWORK
+ assert (env != NULL);
+assert ((*env) != NULL);
+
+ _javanet_shutdownInput (env, this);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_net_PlainSocketImpl_shutdownOutput (JNIEnv *env, jobject this)
+{
+#ifndef WITHOUT_NETWORK
+ assert (env != NULL);
+ assert ((*env) != NULL);
+
+ _javanet_shutdownOutput (env, this);
+#else /* not WITHOUT_NETWORK */
+#endif /* not WITHOUT_NETWORK */
+}
+
/* end of file */
Index: native/jni/java-net/javanet.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.c,v
retrieving revision 1.19
diff -u -r1.19 javanet.c
--- native/jni/java-net/javanet.c 26 Oct 2004 20:26:03 -0000 1.19
+++ native/jni/java-net/javanet.c 12 Jan 2005 08:12:13 -0000
@@ -1,5 +1,5 @@
/* javanet.c - Common internal functions for the java.net package
- Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -1369,4 +1369,56 @@
#endif /* not WITHOUT_NETWORK */
}
+void
+_javanet_shutdownInput (JNIEnv *env, jobject this)
+{
+ int fd;
+
+ assert (env != NULL);
+ assert ((*env) != NULL);
+
+ /* Get the real file descriptor. */
+ fd = _javanet_get_int_field (env, this, "native_fd");
+ if (fd == -1)
+ {
+ JCL_ThrowException(env, SOCKET_EXCEPTION,
+ "Internal error: _javanet_get_option(): no native file descriptor");
+ return;
+ }
+
+ /* Shutdown input stream of socket. */
+ if (shutdown (fd, SHUT_RD) == -1)
+ {
+ JCL_ThrowException (env, SOCKET_EXCEPTION,
+ "Can't shutdown input of socket");
+ return;
+ }
+}
+
+void
+_javanet_shutdownOutput (JNIEnv *env, jobject this)
+{
+ int fd;
+
+ assert (env != NULL);
+ assert ((*env) != NULL);
+
+ /* Get the real file descriptor. */
+ fd = _javanet_get_int_field (env, this, "native_fd");
+ if (fd == -1)
+ {
+ JCL_ThrowException(env, SOCKET_EXCEPTION,
+ "Internal error: _javanet_get_option(): no native file descriptor");
+ return;
+ }
+
+ /* Shutdown output stream of socket. */
+ if (shutdown (fd, SHUT_WR) == -1)
+ {
+ JCL_ThrowException (env, SOCKET_EXCEPTION,
+ "Can't shutdown output of socket");
+ return;
+ }
+}
+
/* end of file */
Index: native/jni/java-net/javanet.h
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-net/javanet.h,v
retrieving revision 1.7
diff -u -r1.7 javanet.h
--- native/jni/java-net/javanet.h 21 Apr 2004 11:03:00 -0000 1.7
+++ native/jni/java-net/javanet.h 12 Jan 2005 08:12:13 -0000
@@ -1,5 +1,5 @@
/* javanet.h - Declarations for common functions for the java.net package
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -100,6 +100,8 @@
extern void _javanet_sendto(JNIEnv *, jobject, jarray, int, int, int, int);
extern jobject _javanet_get_option(JNIEnv *, jobject, jint);
extern void _javanet_set_option(JNIEnv *, jobject, jint, jobject);
+extern void _javanet_shutdownInput (JNIEnv *, jobject);
+extern void _javanet_shutdownOutput (JNIEnv *, jobject);
/*************************************************************************/