harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r417999 - /incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/AddressUtil.java
Date Thu, 29 Jun 2006 10:52:12 GMT
Author: tellison
Date: Thu Jun 29 03:52:08 2006
New Revision: 417999

URL: http://svn.apache.org/viewvc?rev=417999&view=rev
Log:
Get direct buffer should use the effective address of the buffer.
Enhanced the comment.

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

Modified: incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/AddressUtil.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/AddressUtil.java?rev=417999&r1=417998&r2=417999&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/AddressUtil.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/org/apache/harmony/nio/AddressUtil.java
Thu Jun 29 03:52:08 2006
@@ -26,35 +26,45 @@
 public class AddressUtil {
 
     /**
-     * Gets the address of a direct buffer.
-     * 
-     * @param buf
-     *            the direct buffer whose address shall be return
-     * @return the address of the buffer given
-     */
-    public static long getDirectBufferAddress(Buffer buf) {
-        if (!(buf instanceof DirectBuffer)) {
-            return 0;
-        }
-        return ((DirectBuffer) buf).getBaseAddress().toLong();
-    }
+	 * Gets the start address of a direct buffer.
+	 * <p>
+	 * This method corresponds to the JNI function:
+	 * 
+	 * <pre>
+	 *    void* GetDirectBufferAddress(JNIEnv* env, jobject buf);
+	 * </pre>
+	 * 
+	 * @param buf
+	 *            the direct buffer whose address shall be returned must not be
+	 *            <code>null</code>.
+	 * @return the address of the buffer given, or zero if the buffer is not a
+	 *         direct Buffer.
+	 */
+	public static long getDirectBufferAddress(Buffer buf) {
+		if (!(buf instanceof DirectBuffer)) {
+			return 0;
+		}
+		return ((DirectBuffer) buf).getEffectiveAddress().toLong();
+	}
     
     /**
-     * Gets the address of native resource held by the given channel, if has any.
-     * 
-     * For network related channel, including SocketChannel, ServerSocketChannel 
-     * and DatagramChannel, this method returns a int of Socket handler in Linux 
-     * while returns a SOCKET (UINT_PTR) in windows.
-     * 
-     * For FileChannel, this method returns the native file descriptor.
-     * 
-     * For other channels, this method return 0, which means unsupported operation.
-     * 
-     * @param channel
-     *            the given channel which may holds a native resource address
-     * @return the address of native resource held by the given channel, if any, 
-     *         otherwise return 0
-     */
+	 * Gets the address of native resource held by the given channel, if has
+	 * any.
+	 * 
+	 * For network related channel, including SocketChannel, ServerSocketChannel
+	 * and DatagramChannel, this method returns a int of Socket handler in Linux
+	 * while returns a SOCKET (UINT_PTR) in windows.
+	 * 
+	 * For FileChannel, this method returns the native file descriptor.
+	 * 
+	 * For other channels, this method return 0, which means unsupported
+	 * operation.
+	 * 
+	 * @param channel
+	 *            the given channel which may holds a native resource address
+	 * @return the address of native resource held by the given channel, if any,
+	 *         otherwise return 0
+	 */
     public static long getChannelAddress(Channel channel){
         if(channel instanceof FileDescriptorHandler){
             return getFDAddress(((FileDescriptorHandler) channel).getFD());    



Mime
View raw message