summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/nio')
-rw-r--r--src/java/com/jogamp/common/nio/StructAccessor.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java
index af7b6d1..8ae0c29 100644
--- a/src/java/com/jogamp/common/nio/StructAccessor.java
+++ b/src/java/com/jogamp/common/nio/StructAccessor.java
@@ -83,6 +83,16 @@ public class StructAccessor {
bb.put(byteOffset, v);
}
+ /** Retrieves the boolean at the specified byteOffset. */
+ public final boolean getBooleanAt(final int byteOffset) {
+ return (byte)0 != bb.get(byteOffset);
+ }
+
+ /** Puts a boolean at the specified byteOffset. */
+ public final void setBooleanAt(final int byteOffset, final boolean v) {
+ bb.put(byteOffset, v?(byte)1:(byte)0);
+ }
+
/** Retrieves the char at the specified byteOffset. */
public final char getCharAt(final int byteOffset) {
return bb.getChar(byteOffset);
@@ -213,6 +223,19 @@ public class StructAccessor {
return v;
}
+ public final void setBooleansAt(int byteOffset, final boolean[] v) {
+ for (int i = 0; i < v.length; i++) {
+ bb.put(byteOffset++, v[i]?(byte)1:(byte)0);
+ }
+ }
+
+ public final boolean[] getBooleansAt(int byteOffset, final boolean[] v) {
+ for (int i = 0; i < v.length; i++) {
+ v[i] = (byte)0 != bb.get(byteOffset++);
+ }
+ return v;
+ }
+
public final void setCharsAt(int byteOffset, final char[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
bb.putChar(byteOffset, v[i]);