aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio/StructAccessor.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/nio/StructAccessor.java')
-rw-r--r--src/java/com/jogamp/common/nio/StructAccessor.java50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java
index eef9dc5..d6df083 100644
--- a/src/java/com/jogamp/common/nio/StructAccessor.java
+++ b/src/java/com/jogamp/common/nio/StructAccessor.java
@@ -1,22 +1,22 @@
/*
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
* Copyright (c) 2010 JogAmp Community. All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
- *
+ *
* - Redistribution of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
- *
+ *
* - Redistribution 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 Sun Microsystems, Inc. or the names of
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
- *
+ *
* This software is provided "AS IS," without a warranty of any kind. ALL
* EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
* INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
@@ -29,11 +29,11 @@
* DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
+ *
* You acknowledge that this software is not designed or intended for use
* in the design, construction, operation or maintenance of any nuclear
* facility.
- *
+ *
* Sun gratefully acknowledges that this software was originally authored
* and developed by Kenneth Bradley Russell and Christopher John Kline.
*/
@@ -58,7 +58,7 @@ public class StructAccessor {
return bb;
}
- /**
+ /**
* Returns a slice of the current ByteBuffer starting at the
* specified byte offset and extending the specified number of
* bytes. Note that this method is not thread-safe with respect to
@@ -116,11 +116,11 @@ public class StructAccessor {
/** Retrieves the int at the specified byteOffset. */
public final int getIntAt(int byteOffset, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 2:
+ case 2:
return (int) bb.getShort(byteOffset) & 0x0000FFFF ;
- case 4:
+ case 4:
return bb.getInt(byteOffset);
- case 8:
+ case 8:
return (int) ( bb.getLong(byteOffset) & 0x00000000FFFFFFFFL ) ;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
@@ -130,20 +130,20 @@ public class StructAccessor {
/** Puts a int at the specified byteOffset. */
public final void setIntAt(int byteOffset, int v, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 2:
+ case 2:
bb.putShort(byteOffset, (short) ( v & 0x0000FFFF ) );
break;
- case 4:
+ case 4:
bb.putInt(byteOffset, v);
break;
- case 8:
+ case 8:
bb.putLong(byteOffset, (long)v & 0x00000000FFFFFFFFL );
break;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
}
}
-
+
/** Retrieves the float at the specified byteOffset. */
public final float getFloatAt(int byteOffset) {
return bb.getFloat(byteOffset);
@@ -173,13 +173,13 @@ public class StructAccessor {
public final void setLongAt(int byteOffset, long v) {
bb.putLong(byteOffset, v);
}
-
+
/** Retrieves the long at the specified byteOffset. */
public final long getLongAt(int byteOffset, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 4:
+ case 4:
return (long) bb.getInt(byteOffset) & 0x00000000FFFFFFFFL;
- case 8:
+ case 8:
return bb.getLong(byteOffset);
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
@@ -189,17 +189,17 @@ public class StructAccessor {
/** Puts a long at the specified byteOffset. */
public final void setLongAt(int byteOffset, long v, int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
- case 4:
+ case 4:
bb.putInt(byteOffset, (int) ( v & 0x00000000FFFFFFFFL ) );
break;
- case 8:
+ case 8:
bb.putLong(byteOffset, v);
break;
default:
throw new InternalError("invalid nativeSizeInBytes "+nativeSizeInBytes);
}
}
-
+
public final void setBytesAt(int byteOffset, byte[] v) {
for (int i = 0; i < v.length; i++) {
bb.put(byteOffset++, v[i]);
@@ -225,18 +225,18 @@ public class StructAccessor {
}
return v;
}
-
+
public final void setShortsAt(int byteOffset, short[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
bb.putShort(byteOffset, v[i]);
- }
+ }
}
-
+
public final short[] getShortsAt(int byteOffset, short[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
v[i] = bb.getShort(byteOffset);
}
- return v;
+ return v;
}
public final void setIntsAt(int byteOffset, int[] v) {