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 2011/04/15 08:03:20 UTC

svn commit: r1092595 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/ native/shared/ test/org/apache/commons/runtime/

Author: mturk
Date: Fri Apr 15 06:03:19 2011
New Revision: 1092595

URL: http://svn.apache.org/viewvc?rev=1092595&view=rev
Log:
Rename NBB to DBB

Added:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java
      - copied, changed from r1092593, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java
      - copied, changed from r1092439, commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java
Removed:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java
    commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java
Modified:
    commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c

Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java (from r1092593, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java&r1=1092593&r2=1092595&rev=1092595&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/NioByteBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectByteBuffer.java Fri Apr 15 06:03:19 2011
@@ -32,10 +32,10 @@ import java.nio.ByteBuffer;
  * </p>
  * @since Runtime 1.0
  */
-public final class NioByteBuffer
+public final class DirectByteBuffer
 {
 
-    private NioByteBuffer()
+    private DirectByteBuffer()
     {
         // No class instance
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c?rev=1092595&r1=1092594&r2=1092595&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/nbb.c Fri Apr 15 06:03:19 2011
@@ -23,10 +23,9 @@
 #include "acr/clazz.h"
 
 /**
- * NioByteBuffer utilities
+ * DirectByteBuffer utilities
  */
-ACR_JNI_EXPORT(jobject, NioByteBuffer, malloc0)(JNI_STDARGS,
-                                                jint size)
+ACR_JNI_EXPORT(jobject, DirectByteBuffer, malloc0)(JNI_STDARGS, jint size)
 {
     void *mem;
     jint sz = ACR_ALIGN_DEFAULT(size);
@@ -45,8 +44,7 @@ ACR_JNI_EXPORT(jobject, NioByteBuffer, m
     return 0;
 }
 
-ACR_JNI_EXPORT(jobject, NioByteBuffer, calloc0)(JNI_STDARGS,
-                                                jint size)
+ACR_JNI_EXPORT(jobject, DirectByteBuffer, calloc0)(JNI_STDARGS, jint size)
 {
     jint  sz = ACR_ALIGN_DEFAULT(size);
     void *mem;
@@ -65,13 +63,13 @@ ACR_JNI_EXPORT(jobject, NioByteBuffer, c
     return 0;
 }
 
-ACR_JNI_EXPORT(jobject, NioByteBuffer, attach0)(JNI_STDARGS,
-                                                jlong src, jint len)
+ACR_JNI_EXPORT(jobject, DirectByteBuffer, attach0)(JNI_STDARGS,
+                                                   jlong src, jint len)
 {
     return (*env)->NewDirectByteBuffer(env, J2P(src, char *), len);
 }
 
-ACR_JNI_EXPORT(void, NioByteBuffer, free0)(JNI_STDARGS, jobject bb)
+ACR_JNI_EXPORT(void, DirectByteBuffer, free0)(JNI_STDARGS, jobject bb)
 {
     void *mem;
 
@@ -88,16 +86,15 @@ ACR_JNI_EXPORT(void, NioByteBuffer, free
     }
 }
 
-ACR_JNI_EXPORT(jlong, NioByteBuffer, addr0)(JNI_STDARGS,
-                                            jobject bb)
+ACR_JNI_EXPORT(jlong, DirectByteBuffer, addr0)(JNI_STDARGS, jobject bb)
 {
     return P2J((*env)->GetDirectBufferAddress(env, bb));
 }
 
-ACR_JNI_EXPORT(void, NioByteBuffer, set0)(JNI_STDARGS,
-                                          jobject bb,
-                                          jint c,
-                                          jint count)
+ACR_JNI_EXPORT(void, DirectByteBuffer, set0)(JNI_STDARGS,
+                                             jobject bb,
+                                             jint c,
+                                             jint count)
 {
     void *m;
     if ((m = (*env)->GetDirectBufferAddress(env, bb))) {
@@ -108,12 +105,12 @@ ACR_JNI_EXPORT(void, NioByteBuffer, set0
     }
 }
 
-ACR_JNI_EXPORT(void, NioByteBuffer, copy0)(JNI_STDARGS,
-                                           jobject srcb,
-                                           jint srco,
-                                           jobject dstb,
-                                           jint dsto,
-                                           jint count)
+ACR_JNI_EXPORT(void, DirectByteBuffer, copy0)(JNI_STDARGS,
+                                              jobject srcb,
+                                              jint srco,
+                                              jobject dstb,
+                                              jint dsto,
+                                              jint count)
 {
     char *d;
     char *s;

Copied: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java (from r1092439, commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java?p2=commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java&p1=commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java&r1=1092439&r2=1092595&rev=1092595&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestDirectByteBuffer.java Fri Apr 15 06:03:19 2011
@@ -23,25 +23,25 @@ import org.testng.Assert;
 import java.nio.ByteBuffer;
 
 @Test(groups = { "core" })
-public class TestNioByteBuffer
+public class TestDirectByteBuffer
 {
 
     public void malloc()
         throws Exception
     {
-        ByteBuffer bb = NioByteBuffer.allocate(1000);
+        ByteBuffer bb = DirectByteBuffer.allocate(1000);
         Assert.assertTrue(bb.isDirect());
         Assert.assertEquals(1000, bb.capacity());
-        NioByteBuffer.free(bb);
+        DirectByteBuffer.free(bb);
     }
 
     public void calloc()
         throws Exception
     {
-        ByteBuffer bb = NioByteBuffer.allocateAndClear(1000);
+        ByteBuffer bb = DirectByteBuffer.allocateAndClear(1000);
         Assert.assertTrue(bb.isDirect());
         Assert.assertEquals(1000, bb.capacity());
-        NioByteBuffer.free(bb);
+        DirectByteBuffer.free(bb);
     }
 
 
@@ -50,7 +50,7 @@ public class TestNioByteBuffer
     {
         // ptr, bb1 and bb2 share the same memory
         Pointer ptr = Memory.malloc(1000);
-        ByteBuffer bb = NioByteBuffer.allocate(ptr);
+        ByteBuffer bb = DirectByteBuffer.allocate(ptr);
         Assert.assertTrue(bb.isDirect());
         Assert.assertEquals(1000, bb.capacity());
         /*
@@ -59,7 +59,7 @@ public class TestNioByteBuffer
          * Byte buffer will probably crash the JVM after the
          * memory is free'd
          * bb.putInt(0xcafebabe);      might write to something else
-         * NioByteBuffer.free(bb);  will free already free'd memory
+         * DirectByteBuffer.free(bb);  will free already free'd memory
          *                             causing core.
          */
     }
@@ -69,7 +69,7 @@ public class TestNioByteBuffer
     {
         // ptr, bb1 and bb2 share the same memory
         Pointer ptr = Memory.malloc(1000);
-        ByteBuffer bb = NioByteBuffer.allocate(ptr);
+        ByteBuffer bb = DirectByteBuffer.allocate(ptr);
         Assert.assertTrue(bb.isDirect());
         Assert.assertEquals(1000, bb.capacity());
         try {
@@ -79,7 +79,7 @@ public class TestNioByteBuffer
             // Exception handler won't help here.
             test_me = false;
             if (test_me) {
-                NioByteBuffer.free(bb);
+                DirectByteBuffer.free(bb);
             }
         } catch (Throwable t) {
             // Empty
@@ -89,29 +89,29 @@ public class TestNioByteBuffer
     public void memset()
         throws Exception
     {
-        ByteBuffer bb = NioByteBuffer.allocate(1000);
+        ByteBuffer bb = DirectByteBuffer.allocate(1000);
         Assert.assertTrue(bb.isDirect());
         bb.putInt(0xcafebabe);
         bb.rewind();
         Assert.assertEquals(0xcafebabe, bb.getInt());
-        NioByteBuffer.set(bb, 0x55, 1000);
+        DirectByteBuffer.set(bb, 0x55, 1000);
         Assert.assertEquals(0x55555555, bb.getInt());
-        NioByteBuffer.free(bb);
+        DirectByteBuffer.free(bb);
     }
 
     public void copy()
         throws Exception
     {
-        ByteBuffer sb = NioByteBuffer.allocate(1000);
-        ByteBuffer db = NioByteBuffer.allocateAndClear(1000);
+        ByteBuffer sb = DirectByteBuffer.allocate(1000);
+        ByteBuffer db = DirectByteBuffer.allocateAndClear(1000);
 //        Assert.assertTrue(sb.isDirect());
 //        Assert.assertTrue(db.isDirect());
         sb.putInt(0xcafebabe);
-        NioByteBuffer.copy(sb, 0, db, 4, 996);
+        DirectByteBuffer.copy(sb, 0, db, 4, 996);
         Assert.assertEquals(0, db.getInt());
         Assert.assertEquals(0xcafebabe, db.getInt());
-        NioByteBuffer.free(sb);
-        NioByteBuffer.free(db);
+        DirectByteBuffer.free(sb);
+        DirectByteBuffer.free(db);
     }
 
 }