aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase')
-rwxr-xr-xsrc/java/com/sun/gluegen/runtime/PointerBuffer.java.javase15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
index 4957b17..6d0029e 100755
--- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
+++ b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase
@@ -63,6 +63,14 @@ public class PointerBuffer {
return position;
}
+ public final PointerBuffer position(int newPos) {
+ if(0>newPos || newPos>=capacity) {
+ throw new IndexOutOfBoundsException();
+ }
+ position = newPos;
+ return this;
+ }
+
public final int remaining() {
return capacity - position;
}
@@ -71,8 +79,9 @@ public class PointerBuffer {
return position < capacity;
}
- public final void rewind() {
+ public final PointerBuffer rewind() {
position=0;
+ return this;
}
int arrayOffset() { return 0; }
@@ -133,7 +142,7 @@ public class PointerBuffer {
}
public long get() {
- long r = get(position+1);
+ long r = get(position);
position++;
return r;
}
@@ -148,7 +157,7 @@ public class PointerBuffer {
}
public PointerBuffer put(long v) {
- put(position+1, v);
+ put(position, v);
position++;
return this;
}