harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From py...@apache.org
Subject svn commit: r423858 - /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
Date Thu, 20 Jul 2006 09:44:16 GMT
Author: pyang
Date: Thu Jul 20 02:44:16 2006
New Revision: 423858

URL: http://svn.apache.org/viewvc?rev=423858&view=rev
Log:
Fix for HARMONY-929 ([classlib][nio]FileChannel.transforTo can use system call to improve
efficiency)

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java?rev=423858&r1=423857&r2=423858&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/internal/FileChannelImpl.java
Thu Jul 20 02:44:16 2006
@@ -450,13 +450,12 @@
             return 0;
         }
         ByteBuffer buffer = null;
-//        if (target instanceof SocketChannelImpl
-//                || target instanceof DatagramChannelImpl) {
-//            // TODO: not implement yet
-//            // return kernelTransfer(handle,
-//            // ((FileChannelImpl) target).handle, position, count);
-//        }
         count = Math.min(count, size() - position);
+        if (target instanceof SocketChannelImpl) {
+            // only socket can be transfered by system call
+            return kernelTransfer(handle, ((SocketChannelImpl) target).getFD(),
+                    position, count);
+        }
         buffer = map(MapMode.READ_ONLY, position, count);
         return target.write(buffer);
     }



Mime
View raw message