You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/23 18:25:07 UTC

svn commit: r767962 - in /commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime: Pointer.java Pointer32.java Pointer64.java

Author: mturk
Date: Thu Apr 23 16:25:06 2009
New Revision: 767962

URL: http://svn.apache.org/viewvc?rev=767962&view=rev
Log:
Add size Pointer method

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java?rev=767962&r1=767961&r2=767962&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Thu Apr 23 16:25:06 2009
@@ -44,11 +44,30 @@
      */
     public static final int SIZEOF = OS.getDataModel() == 64 ? 8 : 4;
 
-    /** Address of the internal pointer
-     * @return Internal pointer address casted to the {@code long}.
+    /**
+     * Address of the internal pointer.
+     * <p>
+     * Depending on the operating system the {@code Number} can be
+     * either {@code Integer} for 32 bit systems of {@code Long} for
+     * a 64 bit system.
+     *</p>
+     *
+     * @return Internal pointer address casted to the {@code Number}.
      */
     public abstract Number address();
 
+    /**
+     * Size of the memory area this pointer consumes.
+     * <p>
+     * Depending on the operating system the {@code Number} can be
+     * either {@code Integer} for 32 bit systems of {@code Long} for
+     * a 64 bit system.
+     *</p>
+     *
+     * @return Internal pointer size casted to the {@code Number}.
+     */
+    public abstract Number size();
+
 
     /** Chack if the pointer is valid
      * @return true if the internal pointer is not {@code NULL}.

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java?rev=767962&r1=767961&r2=767962&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java Thu Apr 23 16:25:06 2009
@@ -59,6 +59,11 @@
         return new Integer(POINTER);
     }
 
+    public Number size()
+    {
+        return new Integer(PLENGTH);
+    }
+
     private static native int  peek0(int addr);
 
     public int peek(int index)

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java?rev=767962&r1=767961&r2=767962&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java Thu Apr 23 16:25:06 2009
@@ -59,6 +59,11 @@
         return new Long(POINTER);
     }
 
+    public Number size()
+    {
+        return new Long(PLENGTH);
+    }
+
     private static native int  peek0(long addr);
 
     public int peek(int index)