You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/11/28 13:55:53 UTC

svn commit: r721463 - in /harmony/enhanced/classlib/trunk/modules/luni/src/main: java/org/apache/harmony/luni/platform/ native/luni/shared/ native/luni/unix/

Author: tellison
Date: Fri Nov 28 04:55:52 2008
New Revision: 721463

URL: http://svn.apache.org/viewvc?rev=721463&view=rev
Log:
Remove sendStream, mark receiveStream deprecated.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java?rev=721463&r1=721462&r2=721463&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/INetworkSystem.java Fri Nov 28 04:55:52 2008
@@ -125,12 +125,13 @@
 	public void createServerStreamSocket(FileDescriptor aFD,
 			boolean preferIPv4Stack) throws SocketException;
 
+	/**
+	 * @deprecated Use {@link #read(FileDescriptor, byte[], int, int, int)}
+	 */
+	@Deprecated
 	public int receiveStream(FileDescriptor aFD, byte[] data, int offset,
 			int count, int timeout) throws IOException;
 
-	public int sendStream(FileDescriptor fd, byte[] data, int offset, int count)
-			throws IOException;
-
 	public void shutdownInput(FileDescriptor descriptor) throws IOException;
 
 	public void shutdownOutput(FileDescriptor descriptor) throws IOException;

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java?rev=721463&r1=721462&r2=721463&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/OSNetworkSystem.java Fri Nov 28 04:55:52 2008
@@ -477,26 +477,6 @@
             int offset, int length, int port, boolean bindToDevice,
             int trafficClass, InetAddress inetAddress) throws IOException;
 
-    /**
-     * Send <code>count</code> bytes from the buffer <code>data</code> at the
-     * <code>offset</code>, on the socket.
-     * 
-     * @param fd
-     * 
-     * @param data
-     *            the send buffer @param offset the offset into the buffer
-     * @param count
-     *            the number of bytes to receive
-     * @return the actual number of bytes sent
-     * @throws IOException
-     * @throws SocketException
-     *             if an error occurs while writing
-     * @deprecated use {@link #write(FileDescriptor, byte[], int, int)}
-     */
-    @Deprecated
-    public native int sendStream(FileDescriptor fd, byte[] data, int offset,
-            int count) throws IOException;
-
     public native void sendUrgentData(FileDescriptor fd, byte value);
 
     public native void setInetAddress(InetAddress sender, byte[] address);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c?rev=721463&r1=721462&r2=721463&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.c Fri Nov 28 04:55:52 2008
@@ -1692,75 +1692,6 @@
 
 
 /*
- * Deprecated : use Java_org_apache_harmony_luni_platform_OSNetworkSystem_write
- */
-JNIEXPORT jint JNICALL
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
-  (JNIEnv * env, jobject thiz, jobject fileDescriptor, jbyteArray data,
-   jint offset, jint count)
-{
-  PORT_ACCESS_FROM_ENV(env);
-  hysocket_t socketP;
-  jbyte *message;
-  I_32 result = 0, sent = 0;
-
-/* TODO: ARRAY PINNING */
-#define INTERNAL_SEND_BUFFER_MAX 512
-  U_8 internalBuffer[INTERNAL_SEND_BUFFER_MAX];
-
-  if (count > INTERNAL_SEND_BUFFER_MAX) {
-    message = hymem_allocate_memory(count);
-    if (message == NULL) {
-      throwNewOutOfMemoryError(env, "");
-      return 0;
-    }
-  } else {
-    message = (jbyte *) internalBuffer;
-  }
-
-  (*env)->GetByteArrayRegion(env, data, offset, count, message);
-  while (sent < count) {
-    socketP = getJavaIoFileDescriptorContentsAsAPointer(env, fileDescriptor);
-
-    if (!hysock_socketIsValid(socketP)) {
-      if (((U_8 *) message) != internalBuffer) {
-        hymem_free_memory(message);
-      }
-
-      throwJavaNetSocketException(env,
-                                  sent == 0 ?
-                                    HYPORT_ERROR_SOCKET_BADSOCKET :
-                                    HYPORT_ERROR_SOCKET_INTERRUPTED);
-      return (jint) 0;
-    }
-
-    result =
-      hysock_write(socketP, (U_8 *) message + sent, (I_32) count - sent,
-                   HYSOCK_NOFLAGS);
-    if (result < 0) {
-      break;
-    }
-    sent += result;
-  }
-
-  if (((U_8 *) message) != internalBuffer) {
-    hymem_free_memory(message);
-  }
-#undef INTERNAL_MAX
-
-  /**
-   * We should always throw an exception if all the data cannot be sent because Java methods
-   * assume all the data will be sent or an error occurs.
-   */
-  if (result < 0) {
-    throwJavaNetSocketException(env, result);
-    return (jint) 0;
-  }
-
-  return (jint) sent;
-}
-
-/*
  * Class:     org_apache_harmony_luni_platform_OSNetworkSystem
  * Method:    shutdownInput
  * Signature: (Ljava/io/FileDescriptor;)V

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h?rev=721463&r1=721462&r2=721463&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/shared/OSNetworkSystem.h Fri Nov 28 04:55:52 2008
@@ -408,15 +408,6 @@
 
 /*
  * Class:     org.apache.harmony.luni.platform.OSNetworkSystem
- * Method:    sendStream
- * Signature: (Ljava/io/FileDescriptor;[BII)I
- * Throws:    java.io.IOException
- */
-JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
-  (JNIEnv *, jobject, jobject, jbyteArray, jint, jint);
-
-/*
- * Class:     org.apache.harmony.luni.platform.OSNetworkSystem
  * Method:    sendUrgentData
  * Signature: (Ljava/io/FileDescriptor;B)V
  */

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt?rev=721463&r1=721462&r2=721463&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/unix/exports.txt Fri Nov 28 04:55:52 2008
@@ -216,7 +216,6 @@
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_createServerStreamSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_createMulticastSocket
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_receiveStream
-Java_org_apache_harmony_luni_platform_OSNetworkSystem_sendStream
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownInput
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_shutdownOutput
 Java_org_apache_harmony_luni_platform_OSNetworkSystem_acceptStreamSocket