summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio/PointerBuffer.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-10 01:35:58 +0100
committerSven Gothel <[email protected]>2011-02-10 01:35:58 +0100
commit29eb568b642faac9475665d000a865fe684d42a4 (patch)
tree48d0fee6df82ce4f8fe35c3466cb3ed8690251dc /src/java/com/jogamp/common/nio/PointerBuffer.java
parentcbb0bc1ef3d8c0464618c9f773cd1b4725059971 (diff)
parente581ea0e1f65101a7d4baf99d18fa43e1aa20b01 (diff)
Merge branch 'master' of github.com:mbien/gluegen
Diffstat (limited to 'src/java/com/jogamp/common/nio/PointerBuffer.java')
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index f43dc20..5f866e1 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -45,9 +45,9 @@ import java.util.HashMap;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class PointerBuffer extends AbstractLongBuffer {
+public abstract class PointerBuffer extends AbstractLongBuffer<PointerBuffer> {
- protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
+ protected HashMap<Long, Buffer> dataMap = new HashMap<Long, Buffer>();
static {
NativeLibrary.ensureNativeLibLoaded();
@@ -58,28 +58,15 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
}
public static PointerBuffer allocate(int size) {
- if (Platform.isJavaSE()) {
- return new PointerBufferSE(ByteBuffer.wrap(new byte[elementSize() * size]));
- } else {
- return new PointerBufferME_CDC_FP(ByteBuffer.wrap(new byte[elementSize() * size]));
- }
+ return new PointerBufferSE(ByteBuffer.wrap(new byte[elementSize() * size]));
}
public static PointerBuffer allocateDirect(int size) {
- if (Platform.isJavaSE()) {
- return new PointerBufferSE(Buffers.newDirectByteBuffer(elementSize() * size));
- } else {
- return new PointerBufferME_CDC_FP(Buffers.newDirectByteBuffer(elementSize() * size));
- }
+ return new PointerBufferSE(Buffers.newDirectByteBuffer(elementSize() * size));
}
public static PointerBuffer wrap(ByteBuffer src) {
- PointerBuffer res;
- if (Platform.isJavaSE()) {
- res = new PointerBufferSE(src);
- } else {
- res = new PointerBufferME_CDC_FP(src);
- }
+ PointerBuffer res = new PointerBufferSE(src);
res.updateBackup();
return res;
@@ -89,6 +76,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG;
}
+ @Override
public final PointerBuffer put(PointerBuffer src) {
if (remaining() < src.remaining()) {
throw new IndexOutOfBoundsException();
@@ -140,7 +128,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
public final Buffer getReferencedBuffer(int index) {
long addr = get(index);
- return (Buffer) dataMap.get(new Long(addr));
+ return dataMap.get(new Long(addr));
}
public final Buffer getReferencedBuffer() {
@@ -151,6 +139,7 @@ public abstract class PointerBuffer extends AbstractLongBuffer {
private native long getDirectBufferAddressImpl(Object directBuffer);
+ @Override
public String toString() {
return "PointerBuffer:"+super.toString();
}