diff options
Diffstat (limited to 'src/java/com/sun/gluegen')
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp | 15 | ||||
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/PointerBuffer.java.javase | 15 |
2 files changed, 24 insertions, 6 deletions
diff --git a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp index 4ab666c..0ec54d0 100755 --- a/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp +++ b/src/java/com/sun/gluegen/runtime/PointerBuffer.java.javame_cdc_fp @@ -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; } @@ -139,7 +148,7 @@ public class PointerBuffer { } public long get() { - long r = get(position+1); + long r = get(position); position++; return r; } @@ -163,7 +172,7 @@ public class PointerBuffer { } public PointerBuffer put(long v) { - put(position+1, v); + put(position, v); position++; return this; } 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; } |