aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common')
-rw-r--r--src/java/com/jogamp/common/nio/AbstractBuffer.java114
-rw-r--r--src/java/com/jogamp/common/nio/AbstractLongBuffer.java144
-rw-r--r--src/java/com/jogamp/common/nio/Int64Buffer.java95
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java10
-rwxr-xr-xsrc/java/com/jogamp/common/nio/Int64BufferSE.java15
-rw-r--r--src/java/com/jogamp/common/nio/NativeBuffer.java33
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java117
-rwxr-xr-xsrc/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java15
-rwxr-xr-xsrc/java/com/jogamp/common/nio/PointerBufferSE.java14
9 files changed, 313 insertions, 244 deletions
diff --git a/src/java/com/jogamp/common/nio/AbstractBuffer.java b/src/java/com/jogamp/common/nio/AbstractBuffer.java
new file mode 100644
index 0000000..d76574b
--- /dev/null
+++ b/src/java/com/jogamp/common/nio/AbstractBuffer.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2010, Sven Gothel
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Sven Gothel nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Sven Gothel BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Created on Saturday, March 27 2010 11:55
+ */
+package com.jogamp.common.nio;
+
+import com.jogamp.common.os.*;
+
+import java.nio.ByteBuffer;
+import java.nio.Buffer;
+import java.util.HashMap;
+
+/**
+ * @author Michael Bien
+ * @author Sven Gothel
+ */
+public abstract class AbstractBuffer implements NativeBuffer {
+
+ protected final ByteBuffer bb;
+ protected int capacity;
+ protected int position;
+
+ static {
+ NativeLibrary.ensureNativeLibLoaded();
+ }
+
+ protected AbstractBuffer(ByteBuffer bb, int elementSize) {
+ this.bb = bb;
+
+ capacity = bb.capacity() / elementSize;
+ position = 0;
+ }
+
+ public final int limit() {
+ return capacity;
+ }
+
+ public final int capacity() {
+ return capacity;
+ }
+
+ public final int position() {
+ return position;
+ }
+
+ public final NativeBuffer position(int newPos) {
+ if (0 > newPos || newPos >= capacity) {
+ throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
+ "My capacity is "+capacity()+".");
+ }
+ position = newPos;
+ return this;
+ }
+
+ public final int remaining() {
+ return capacity - position;
+ }
+
+ public final boolean hasRemaining() {
+ return position < capacity;
+ }
+
+ public final NativeBuffer rewind() {
+ position = 0;
+ return this;
+ }
+
+ public boolean hasArray() {
+ return false;
+ }
+
+ public int arrayOffset() {
+ return 0;
+ }
+
+ public final ByteBuffer getBuffer() {
+ return bb;
+ }
+
+ public final boolean isDirect() {
+ return bb.isDirect();
+ }
+
+ public String toString() {
+ return "AbstractBuffer[capacity "+capacity+", position "+position+", elementSize "+(bb.capacity()/capacity)+", ByteBuffer.capacity "+bb.capacity()+"]";
+ }
+
+}
diff --git a/src/java/com/jogamp/common/nio/AbstractLongBuffer.java b/src/java/com/jogamp/common/nio/AbstractLongBuffer.java
new file mode 100644
index 0000000..ad90ffc
--- /dev/null
+++ b/src/java/com/jogamp/common/nio/AbstractLongBuffer.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2010, Michael Bien
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Michael Bien nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL Michael Bien BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Created on Saturday, March 27 2010 11:55
+ */
+package com.jogamp.common.nio;
+
+import com.jogamp.common.os.*;
+import java.nio.ByteBuffer;
+import java.nio.Buffer;
+import java.util.HashMap;
+
+/**
+ * Hardware independent container for native pointer arrays.
+ *
+ * The native values (NIO direct ByteBuffer) might be 32bit or 64bit wide,
+ * depending of the CPU pointer width.
+ *
+ * @author Michael Bien
+ * @author Sven Gothel
+ */
+public abstract class AbstractLongBuffer extends AbstractBuffer {
+
+ protected long[] backup;
+
+ protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
+
+ static {
+ NativeLibrary.ensureNativeLibLoaded();
+ }
+
+ protected AbstractLongBuffer(ByteBuffer bb, int elementSize) {
+ super(bb, elementSize);
+
+ backup = new long[capacity];
+ }
+
+ final void updateBackup() {
+ for (int i = 0; i < capacity; i++) {
+ backup[i] = get(i);
+ }
+ }
+
+ public final boolean hasArray() {
+ return true;
+ }
+
+ public final long[] array() {
+ return backup;
+ }
+
+ /** Absolute get method. Get the pointer value at the given index */
+ public abstract long get(int idx);
+
+ /** Relative get method. Get the pointer value at the current position and increment the position by one. */
+ public final long get() {
+ long r = get(position);
+ position++;
+ return r;
+ }
+
+ /**
+ * Relative bulk get method. Copy the pointer values <code> [ position .. position+length [</code>
+ * to the destination array <code> [ dest[offset] .. dest[offset+length] [ </code>
+ * and increment the position by <code>length</code>. */
+ public final AbstractLongBuffer get(long[] dest, int offset, int length) {
+ if (dest.length<offset+length) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (remaining() < length) {
+ throw new IndexOutOfBoundsException();
+ }
+ while(length>0) {
+ dest[offset++] = get(position++);
+ length--;
+ }
+ return this;
+ }
+
+ /** Absolute put method. Put the pointer value at the given index */
+ public abstract AbstractLongBuffer put(int index, long value);
+
+ /** Relative put method. Put the pointer value at the current position and increment the position by one. */
+ public final AbstractLongBuffer put(long value) {
+ put(position, value);
+ position++;
+ return this;
+ }
+
+ /**
+ * Relative bulk put method. Put the pointer values <code> [ src[offset] .. src[offset+length] [</code>
+ * at the current position and increment the position by <code>length</code>. */
+ public final AbstractLongBuffer put(long[] src, int offset, int length) {
+ if (src.length<offset+length) {
+ throw new IndexOutOfBoundsException();
+ }
+ if (remaining() < length) {
+ throw new IndexOutOfBoundsException();
+ }
+ while(length>0) {
+ put(position++, src[offset++]);
+ length--;
+ }
+ return this;
+ }
+
+ /**
+ * Relative bulk get method. Copy the source values <code> src[position .. capacity] [</code>
+ * to this buffer and increment the position by <code>capacity-position</code>. */
+ public AbstractLongBuffer put(AbstractLongBuffer src) {
+ if (remaining() < src.remaining()) {
+ throw new IndexOutOfBoundsException();
+ }
+ while (src.hasRemaining()) {
+ put(src.get());
+ }
+ return this;
+ }
+}
diff --git a/src/java/com/jogamp/common/nio/Int64Buffer.java b/src/java/com/jogamp/common/nio/Int64Buffer.java
index d1fafb6..6f0b7a3 100644
--- a/src/java/com/jogamp/common/nio/Int64Buffer.java
+++ b/src/java/com/jogamp/common/nio/Int64Buffer.java
@@ -27,7 +27,7 @@
package com.jogamp.common.nio;
-import com.jogamp.common.os.Platform;
+import com.jogamp.common.os.*;
import java.nio.ByteBuffer;
/**
@@ -38,15 +38,10 @@ import java.nio.ByteBuffer;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class Int64Buffer implements NativeBuffer/*<PointerBuffer>*/ {
-
- protected final ByteBuffer bb;
- protected int capacity;
- protected int position;
- protected long[] backup;
+public abstract class Int64Buffer extends AbstractLongBuffer {
protected Int64Buffer(ByteBuffer bb) {
- this.bb = bb;
+ super(bb, elementSize());
}
public static Int64Buffer allocate(int size) {
@@ -77,94 +72,12 @@ public abstract class Int64Buffer implements NativeBuffer/*<PointerBuffer>*/ {
}
- void updateBackup() {
- for (int i = 0; i < capacity; i++) {
- backup[i] = get(i);
- }
- }
-
- int arrayOffset() {
- return 0;
- }
-
public static int elementSize() {
return Buffers.SIZEOF_LONG;
}
- public int limit() {
- return capacity;
- }
-
- public int capacity() {
- return capacity;
- }
-
- public int position() {
- return position;
- }
-
- public Int64Buffer position(int newPos) {
- if (0 > newPos || newPos >= capacity) {
- throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
- "My capacity is "+capacity()+".");
- }
- position = newPos;
- return this;
- }
-
- public int remaining() {
- return capacity - position;
- }
-
- public boolean hasRemaining() {
- return position < capacity;
- }
-
- public Int64Buffer rewind() {
- position = 0;
- return this;
- }
-
- boolean hasArray() {
- return true;
- }
-
- public long[] array() {
- return backup;
- }
-
- public ByteBuffer getBuffer() {
- return bb;
- }
-
- public boolean isDirect() {
- return bb.isDirect();
- }
-
- public long get() {
- long r = get(position);
- position++;
- return r;
- }
-
- public abstract long get(int idx);
-
- public abstract Int64Buffer put(int index, long value);
-
- public abstract Int64Buffer put(long value);
-
- public Int64Buffer put(Int64Buffer src) {
- if (remaining() < src.remaining()) {
- throw new IndexOutOfBoundsException();
- }
- while (src.hasRemaining()) {
- put(src.get());
- }
- return this;
- }
-
public String toString() {
- return "Int64Buffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]";
+ return "Int64Buffer:"+super.toString();
}
}
diff --git a/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java b/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
index 5cad3ef..9621677 100755
--- a/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
+++ b/src/java/com/jogamp/common/nio/Int64BufferME_CDC_FP.java
@@ -56,7 +56,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -69,7 +69,7 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
return lo << 32 | hi;
}
- public Int64Buffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -86,10 +86,4 @@ final class Int64BufferME_CDC_FP extends Int64Buffer {
}
return this;
}
-
- public Int64Buffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/Int64BufferSE.java b/src/java/com/jogamp/common/nio/Int64BufferSE.java
index 7387320..fc262fd 100755
--- a/src/java/com/jogamp/common/nio/Int64BufferSE.java
+++ b/src/java/com/jogamp/common/nio/Int64BufferSE.java
@@ -49,21 +49,16 @@ final class Int64BufferSE extends Int64Buffer {
super(bb);
this.pb = bb.asLongBuffer();
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
return pb.get(idx);
}
- public Int64Buffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -71,10 +66,4 @@ final class Int64BufferSE extends Int64Buffer {
pb.put(idx, v);
return this;
}
-
- public Int64Buffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/NativeBuffer.java b/src/java/com/jogamp/common/nio/NativeBuffer.java
index 170297a..99a5cbc 100644
--- a/src/java/com/jogamp/common/nio/NativeBuffer.java
+++ b/src/java/com/jogamp/common/nio/NativeBuffer.java
@@ -11,37 +11,44 @@ import java.nio.ByteBuffer;
* @author Michael Bien
* @author Sven Gothel
*/
-/*public*/ interface NativeBuffer/*<B extends NativeBuffer>*/ { // make public as soon we support generics
-
- public boolean hasRemaining();
-
- public boolean isDirect();
+public interface NativeBuffer/*<B extends NativeBuffer>*/ {
public int limit();
+ public int capacity();
+
public int position();
+ public NativeBuffer position(int newPos);
+
public int remaining();
- public long[] array();
+ public boolean hasRemaining();
+
+ public NativeBuffer rewind();
+
+ public boolean hasArray();
+
+ public int arrayOffset();
+
+ public ByteBuffer getBuffer();
+
+ public boolean isDirect();
- public int capacity();
/*
- public B rewind();
+ public long[] array();
- public B position(int newPos);
+ public B rewind();
public B put(int index, long value);
public B put(long value);
public B put(B src);
-*/
+
public long get();
public long get(int idx);
-
- public ByteBuffer getBuffer();
-
+*/
}
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index 9b7232f..26d2e7b 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -30,8 +30,7 @@
*/
package com.jogamp.common.nio;
-import com.jogamp.common.os.NativeLibrary;
-import com.jogamp.common.os.Platform;
+import com.jogamp.common.os.*;
import java.nio.ByteBuffer;
import java.nio.Buffer;
import java.util.HashMap;
@@ -45,12 +44,7 @@ import java.util.HashMap;
* @author Michael Bien
* @author Sven Gothel
*/
-public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
-
- protected final ByteBuffer bb;
- protected int capacity;
- protected int position;
- protected long[] backup;
+public abstract class PointerBuffer extends AbstractLongBuffer {
protected HashMap/*<aptr, buffer>*/ dataMap = new HashMap();
@@ -59,7 +53,7 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
}
protected PointerBuffer(ByteBuffer bb) {
- this.bb = bb;
+ super(bb, elementSize());
}
public static PointerBuffer allocate(int size) {
@@ -90,88 +84,33 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
}
- void updateBackup() {
- for (int i = 0; i < capacity; i++) {
- backup[i] = get(i);
- }
- }
-
- int arrayOffset() {
- return 0;
- }
-
public static int elementSize() {
return Platform.is32Bit() ? Buffers.SIZEOF_INT : Buffers.SIZEOF_LONG;
}
- public int limit() {
- return capacity;
- }
-
- public int capacity() {
- return capacity;
- }
-
- public int position() {
- return position;
- }
-
- public PointerBuffer position(int newPos) {
- if (0 > newPos || newPos >= capacity) {
- throw new IndexOutOfBoundsException("Sorry to interrupt, but the position "+newPos+" was out of bounds. " +
- "My capacity is "+capacity()+".");
+ public final PointerBuffer put(PointerBuffer src) {
+ if (remaining() < src.remaining()) {
+ throw new IndexOutOfBoundsException();
+ }
+ long addr;
+ while (src.hasRemaining()) {
+ addr = src.get();
+ put(addr);
+ Long addrL = new Long(addr);
+ Buffer bb = (Buffer) dataMap.get(addrL);
+ if(null!=bb) {
+ dataMap.put(addrL, bb);
+ } else {
+ dataMap.remove(addrL);
+ }
}
- position = newPos;
- return this;
- }
-
- public int remaining() {
- return capacity - position;
- }
-
- public boolean hasRemaining() {
- return position < capacity;
- }
-
- public PointerBuffer rewind() {
- position = 0;
return this;
}
- boolean hasArray() {
- return true;
- }
-
- public long[] array() {
- return backup;
- }
-
- public ByteBuffer getBuffer() {
- return bb;
- }
-
- public boolean isDirect() {
- return bb.isDirect();
- }
-
- public long get() {
- long r = get(position);
- position++;
- return r;
- }
-
- public abstract long get(int idx);
-
- /** put the pointer value at position index */
- public abstract PointerBuffer put(int index, long value);
-
- /** put the pointer value at the end */
- public abstract PointerBuffer put(long value);
-
/** Put the address of the given direct Buffer at the given position
of this pointer array.
Adding a reference of the given direct Buffer to this object. */
- public PointerBuffer referenceBuffer(int index, Buffer bb) {
+ public final PointerBuffer referenceBuffer(int index, Buffer bb) {
if(null==bb) {
throw new RuntimeException("Buffer is null");
}
@@ -191,18 +130,18 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
/** Put the address of the given direct Buffer at the end
of this pointer array.
Adding a reference of the given direct Buffer to this object. */
- public PointerBuffer referenceBuffer(Buffer bb) {
+ public final PointerBuffer referenceBuffer(Buffer bb) {
referenceBuffer(position, bb);
position++;
return this;
}
- public Buffer getReferencedBuffer(int index) {
+ public final Buffer getReferencedBuffer(int index) {
long addr = get(index);
return (Buffer) dataMap.get(new Long(addr));
}
- public Buffer getReferencedBuffer() {
+ public final Buffer getReferencedBuffer() {
Buffer bb = getReferencedBuffer(position);
position++;
return bb;
@@ -210,18 +149,8 @@ public abstract class PointerBuffer implements NativeBuffer/*<PointerBuffer>*/ {
private native long getDirectBufferAddressImpl(Object directBuffer);
- public PointerBuffer put(PointerBuffer src) {
- if (remaining() < src.remaining()) {
- throw new IndexOutOfBoundsException();
- }
- while (src.hasRemaining()) {
- put(src.get());
- }
- return this;
- }
-
public String toString() {
- return "PointerBuffer[capacity "+capacity+", position "+position+", elementSize "+elementSize()+", ByteBuffer.capacity "+bb.capacity()+"]";
+ return "PointerBuffer:"+super.toString();
}
}
diff --git a/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java b/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
index 74c049b..6e2c7d9 100755
--- a/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
+++ b/src/java/com/jogamp/common/nio/PointerBufferME_CDC_FP.java
@@ -49,14 +49,9 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
PointerBufferME_CDC_FP(ByteBuffer bb) {
super(bb);
this.pb = bb.asIntBuffer();
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -73,7 +68,7 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
}
}
- public PointerBuffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -94,10 +89,4 @@ final class PointerBufferME_CDC_FP extends PointerBuffer {
}
return this;
}
-
- public PointerBuffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}
diff --git a/src/java/com/jogamp/common/nio/PointerBufferSE.java b/src/java/com/jogamp/common/nio/PointerBufferSE.java
index f750430..11dc629 100755
--- a/src/java/com/jogamp/common/nio/PointerBufferSE.java
+++ b/src/java/com/jogamp/common/nio/PointerBufferSE.java
@@ -54,14 +54,9 @@ final class PointerBufferSE extends PointerBuffer {
} else {
this.pb = bb.asLongBuffer();
}
-
- capacity = bb.capacity() / elementSize();
-
- position = 0;
- backup = new long[capacity];
}
- public long get(int idx) {
+ public final long get(int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -72,7 +67,7 @@ final class PointerBufferSE extends PointerBuffer {
}
}
- public PointerBuffer put(int idx, long v) {
+ public final AbstractLongBuffer put(int idx, long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -85,9 +80,4 @@ final class PointerBufferSE extends PointerBuffer {
return this;
}
- public PointerBuffer put(long v) {
- put(position, v);
- position++;
- return this;
- }
}