summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/nio
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
committerSven Gothel <[email protected]>2014-07-03 16:06:47 +0200
commitdf9ff7f340a5ab4e07efc613f5f264eeae63d4c7 (patch)
tree239ae276b82024b140428e6c0fe5d739fdd686a4 /src/java/com/jogamp/common/nio
parenteb47aaba63e3b1bf55f274a0f338f1010a017ae4 (diff)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74)
Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines
Diffstat (limited to 'src/java/com/jogamp/common/nio')
-rw-r--r--src/java/com/jogamp/common/nio/AbstractBuffer.java4
-rw-r--r--src/java/com/jogamp/common/nio/Buffers.java160
-rw-r--r--src/java/com/jogamp/common/nio/CachedBufferFactory.java78
-rw-r--r--src/java/com/jogamp/common/nio/PointerBuffer.java44
-rw-r--r--src/java/com/jogamp/common/nio/StructAccessor.java68
5 files changed, 177 insertions, 177 deletions
diff --git a/src/java/com/jogamp/common/nio/AbstractBuffer.java b/src/java/com/jogamp/common/nio/AbstractBuffer.java
index 1be279b..2da6440 100644
--- a/src/java/com/jogamp/common/nio/AbstractBuffer.java
+++ b/src/java/com/jogamp/common/nio/AbstractBuffer.java
@@ -60,7 +60,7 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
* @param elementSize the target element size in bytes.
* @param capacity the target capacity in elements of size <code>elementSize</code>.
*/
- protected AbstractBuffer(Buffer buffer, int elementSize, int capacity) {
+ protected AbstractBuffer(final Buffer buffer, final int elementSize, final int capacity) {
this.buffer = buffer;
this.elementSize = elementSize;
this.capacity = capacity;
@@ -89,7 +89,7 @@ public abstract class AbstractBuffer<B extends AbstractBuffer> implements Native
}
@Override
- public final B position(int newPos) {
+ public final B position(final 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()+".");
diff --git a/src/java/com/jogamp/common/nio/Buffers.java b/src/java/com/jogamp/common/nio/Buffers.java
index 2a37e47..8fff30e 100644
--- a/src/java/com/jogamp/common/nio/Buffers.java
+++ b/src/java/com/jogamp/common/nio/Buffers.java
@@ -69,19 +69,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static ByteBuffer newDirectByteBuffer(int numElements) {
+ public static ByteBuffer newDirectByteBuffer(final int numElements) {
return nativeOrder(ByteBuffer.allocateDirect(numElements));
}
- public static ByteBuffer newDirectByteBuffer(byte[] values, int offset, int length) {
+ public static ByteBuffer newDirectByteBuffer(final byte[] values, final int offset, final int length) {
return (ByteBuffer)newDirectByteBuffer(length).put(values, offset, length).rewind();
}
- public static ByteBuffer newDirectByteBuffer(byte[] values, int offset) {
+ public static ByteBuffer newDirectByteBuffer(final byte[] values, final int offset) {
return newDirectByteBuffer(values, offset, values.length-offset);
}
- public static ByteBuffer newDirectByteBuffer(byte[] values) {
+ public static ByteBuffer newDirectByteBuffer(final byte[] values) {
return newDirectByteBuffer(values, 0);
}
@@ -90,19 +90,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static DoubleBuffer newDirectDoubleBuffer(int numElements) {
+ public static DoubleBuffer newDirectDoubleBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_DOUBLE).asDoubleBuffer();
}
- public static DoubleBuffer newDirectDoubleBuffer(double[] values, int offset, int length) {
+ public static DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset, final int length) {
return (DoubleBuffer)newDirectDoubleBuffer(length).put(values, offset, length).rewind();
}
- public static DoubleBuffer newDirectDoubleBuffer(double[] values, int offset) {
+ public static DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset) {
return newDirectDoubleBuffer(values, offset, values.length - offset);
}
- public static DoubleBuffer newDirectDoubleBuffer(double[] values) {
+ public static DoubleBuffer newDirectDoubleBuffer(final double[] values) {
return newDirectDoubleBuffer(values, 0);
}
@@ -111,19 +111,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static FloatBuffer newDirectFloatBuffer(int numElements) {
+ public static FloatBuffer newDirectFloatBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_FLOAT).asFloatBuffer();
}
- public static FloatBuffer newDirectFloatBuffer(float[] values, int offset, int length) {
+ public static FloatBuffer newDirectFloatBuffer(final float[] values, final int offset, final int length) {
return (FloatBuffer)newDirectFloatBuffer(length).put(values, offset, length).rewind();
}
- public static FloatBuffer newDirectFloatBuffer(float[] values, int offset) {
+ public static FloatBuffer newDirectFloatBuffer(final float[] values, final int offset) {
return newDirectFloatBuffer(values, offset, values.length - offset);
}
- public static FloatBuffer newDirectFloatBuffer(float[] values) {
+ public static FloatBuffer newDirectFloatBuffer(final float[] values) {
return newDirectFloatBuffer(values, 0);
}
@@ -132,19 +132,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static IntBuffer newDirectIntBuffer(int numElements) {
+ public static IntBuffer newDirectIntBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_INT).asIntBuffer();
}
- public static IntBuffer newDirectIntBuffer(int[] values, int offset, int length) {
+ public static IntBuffer newDirectIntBuffer(final int[] values, final int offset, final int length) {
return (IntBuffer)newDirectIntBuffer(length).put(values, offset, length).rewind();
}
- public static IntBuffer newDirectIntBuffer(int[] values, int offset) {
+ public static IntBuffer newDirectIntBuffer(final int[] values, final int offset) {
return newDirectIntBuffer(values, offset, values.length - offset);
}
- public static IntBuffer newDirectIntBuffer(int[] values) {
+ public static IntBuffer newDirectIntBuffer(final int[] values) {
return newDirectIntBuffer(values, 0);
}
@@ -153,19 +153,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static LongBuffer newDirectLongBuffer(int numElements) {
+ public static LongBuffer newDirectLongBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_LONG).asLongBuffer();
}
- public static LongBuffer newDirectLongBuffer(long[] values, int offset, int length) {
+ public static LongBuffer newDirectLongBuffer(final long[] values, final int offset, final int length) {
return (LongBuffer)newDirectLongBuffer(length).put(values, offset, length).rewind();
}
- public static LongBuffer newDirectLongBuffer(long[] values, int offset) {
+ public static LongBuffer newDirectLongBuffer(final long[] values, final int offset) {
return newDirectLongBuffer(values, offset, values.length - offset);
}
- public static LongBuffer newDirectLongBuffer(long[] values) {
+ public static LongBuffer newDirectLongBuffer(final long[] values) {
return newDirectLongBuffer(values, 0);
}
@@ -174,19 +174,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static ShortBuffer newDirectShortBuffer(int numElements) {
+ public static ShortBuffer newDirectShortBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_SHORT).asShortBuffer();
}
- public static ShortBuffer newDirectShortBuffer(short[] values, int offset, int length) {
+ public static ShortBuffer newDirectShortBuffer(final short[] values, final int offset, final int length) {
return (ShortBuffer)newDirectShortBuffer(length).put(values, offset, length).rewind();
}
- public static ShortBuffer newDirectShortBuffer(short[] values, int offset) {
+ public static ShortBuffer newDirectShortBuffer(final short[] values, final int offset) {
return newDirectShortBuffer(values, offset, values.length - offset);
}
- public static ShortBuffer newDirectShortBuffer(short[] values) {
+ public static ShortBuffer newDirectShortBuffer(final short[] values) {
return newDirectShortBuffer(values, 0);
}
@@ -195,19 +195,19 @@ public class Buffers {
* elements. The returned buffer will have its byte order set to
* the host platform's native byte order.
*/
- public static CharBuffer newDirectCharBuffer(int numElements) {
+ public static CharBuffer newDirectCharBuffer(final int numElements) {
return newDirectByteBuffer(numElements * SIZEOF_SHORT).asCharBuffer();
}
- public static CharBuffer newDirectCharBuffer(char[] values, int offset, int length) {
+ public static CharBuffer newDirectCharBuffer(final char[] values, final int offset, final int length) {
return (CharBuffer)newDirectCharBuffer(length).put(values, offset, length).rewind();
}
- public static CharBuffer newDirectCharBuffer(char[] values, int offset) {
+ public static CharBuffer newDirectCharBuffer(final char[] values, final int offset) {
return newDirectCharBuffer(values, offset, values.length - offset);
}
- public static CharBuffer newDirectCharBuffer(char[] values) {
+ public static CharBuffer newDirectCharBuffer(final char[] values) {
return newDirectCharBuffer(values, 0);
}
@@ -216,7 +216,7 @@ public class Buffers {
* @see #slice(java.nio.Buffer, int, int)
*/
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B slice(B buffer) {
+ public static <B extends Buffer> B slice(final B buffer) {
if (buffer instanceof ByteBuffer) {
final ByteBuffer bb = (ByteBuffer) buffer;
return (B) bb.slice().order(bb.order()); // slice and duplicate may change byte order
@@ -242,9 +242,9 @@ public class Buffers {
* Concurrency warning: this method changes the buffers position and limit but
* will restore it before return.
*/
- public static <B extends Buffer> B slice(B buffer, int offset, int size) {
- int pos = buffer.position();
- int limit = buffer.limit();
+ public static <B extends Buffer> B slice(final B buffer, final int offset, final int size) {
+ final int pos = buffer.position();
+ final int limit = buffer.limit();
B slice = null;
try {
@@ -280,7 +280,7 @@ public class Buffers {
* @param floatSize {@link Buffers#SIZEOF_FLOAT} size
* @return FloatBuffer w/ native byte order as given ByteBuffer
*/
- public static final FloatBuffer slice2Float(Buffer buf, int floatStartPos, int floatSize) {
+ public static final FloatBuffer slice2Float(final Buffer buf, final int floatStartPos, final int floatSize) {
final int pos;
final int limit;
if(null != buf) {
@@ -293,12 +293,12 @@ public class Buffers {
final FloatBuffer res;
try {
if(buf instanceof ByteBuffer) {
- ByteBuffer bb = (ByteBuffer) buf;
+ final ByteBuffer bb = (ByteBuffer) buf;
bb.position( floatStartPos * Buffers.SIZEOF_FLOAT );
bb.limit( (floatStartPos + floatSize) * Buffers.SIZEOF_FLOAT );
res = bb.slice().order(bb.order()).asFloatBuffer(); // slice and duplicate may change byte order
} else if(buf instanceof FloatBuffer) {
- FloatBuffer fb = (FloatBuffer) buf;
+ final FloatBuffer fb = (FloatBuffer) buf;
fb.position( floatStartPos );
fb.limit( floatStartPos + floatSize );
res = fb.slice(); // slice and duplicate may change byte order
@@ -335,7 +335,7 @@ public class Buffers {
* @param floatSize {@link Buffers#SIZEOF_FLOAT} size
* @return FloatBuffer w/ native byte order as given ByteBuffer
*/
- public static final FloatBuffer slice2Float(float[] backing, int floatStartPos, int floatSize) {
+ public static final FloatBuffer slice2Float(final float[] backing, final int floatStartPos, final int floatSize) {
return (FloatBuffer) FloatBuffer.wrap(backing, floatStartPos, floatSize).mark();
}
@@ -345,7 +345,7 @@ public class Buffers {
* that operation is supported by the underlying NIO
* implementation.
*/
- public static ByteBuffer nativeOrder(ByteBuffer buf) {
+ public static ByteBuffer nativeOrder(final ByteBuffer buf) {
return buf.order(ByteOrder.nativeOrder());
}
@@ -353,7 +353,7 @@ public class Buffers {
* Returns the size of a single element of the given buffer in bytes
* or <code>0</code> if the given buffer is <code>null</code>.
*/
- public static int sizeOfBufferElem(Object buffer) {
+ public static int sizeOfBufferElem(final Object buffer) {
if (buffer == null) {
return 0;
}
@@ -384,7 +384,7 @@ public class Buffers {
* @return If <code>buffer</code> is null, returns <code>0<code>, otherwise the remaining size in elements.
* @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
*/
- public static int remainingElem(Object buffer) throws IllegalArgumentException {
+ public static int remainingElem(final Object buffer) throws IllegalArgumentException {
if (buffer == null) {
return 0;
}
@@ -404,13 +404,13 @@ public class Buffers {
* @return If <code>buffer</code> is null, returns <code>0<code>, otherwise the remaining size in bytes.
* @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
*/
- public static int remainingBytes(Object buffer) throws IllegalArgumentException {
+ public static int remainingBytes(final Object buffer) throws IllegalArgumentException {
if (buffer == null) {
return 0;
}
final int bytesRemaining;
if (buffer instanceof Buffer) {
- int elementsRemaining = ((Buffer) buffer).remaining();
+ final int elementsRemaining = ((Buffer) buffer).remaining();
if (buffer instanceof ByteBuffer) {
bytesRemaining = elementsRemaining;
} else if (buffer instanceof FloatBuffer) {
@@ -441,7 +441,7 @@ public class Buffers {
* Helper routine to tell whether a buffer is direct or not. Null
* pointers <b>are</b> considered direct.
*/
- public static boolean isDirect(Object buf) {
+ public static boolean isDirect(final Object buf) {
if (buf == null) {
return true;
}
@@ -478,7 +478,7 @@ public class Buffers {
* account the Buffer position and the underlying type. This is
* the total offset for Direct Buffers.
*/
- public static int getDirectBufferByteOffset(Object buf) {
+ public static int getDirectBufferByteOffset(final Object buf) {
if (buf == null) {
return 0;
}
@@ -513,7 +513,7 @@ public class Buffers {
* @throws UnsupportedOperationException if the passed Object does not have an array backing store
* @throws IllegalArgumentException if the passed Object is neither of type {@link java.nio.Buffer} or {@link NativeBuffer}.
*/
- public static Object getArray(Object buf) throws UnsupportedOperationException, IllegalArgumentException {
+ public static Object getArray(final Object buf) throws UnsupportedOperationException, IllegalArgumentException {
if (buf == null) {
return null;
}
@@ -532,7 +532,7 @@ public class Buffers {
* object. The array offset also includes the position offset
* within the buffer, in addition to any array offset.
*/
- public static int getIndirectBufferByteOffset(Object buf) {
+ public static int getIndirectBufferByteOffset(final Object buf) {
if (buf == null) {
return 0;
}
@@ -573,9 +573,9 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static ByteBuffer copyByteBuffer(ByteBuffer orig) {
+ public static ByteBuffer copyByteBuffer(final ByteBuffer orig) {
final int op0 = orig.position();
- ByteBuffer dest = newDirectByteBuffer(orig.remaining());
+ final ByteBuffer dest = newDirectByteBuffer(orig.remaining());
dest.put(orig);
dest.rewind();
orig.position(op0);
@@ -590,7 +590,7 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static FloatBuffer copyFloatBuffer(FloatBuffer orig) {
+ public static FloatBuffer copyFloatBuffer(final FloatBuffer orig) {
return copyFloatBufferAsByteBuffer(orig).asFloatBuffer();
}
@@ -602,7 +602,7 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static IntBuffer copyIntBuffer(IntBuffer orig) {
+ public static IntBuffer copyIntBuffer(final IntBuffer orig) {
return copyIntBufferAsByteBuffer(orig).asIntBuffer();
}
@@ -614,7 +614,7 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static ShortBuffer copyShortBuffer(ShortBuffer orig) {
+ public static ShortBuffer copyShortBuffer(final ShortBuffer orig) {
return copyShortBufferAsByteBuffer(orig).asShortBuffer();
}
@@ -629,9 +629,9 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static ByteBuffer copyFloatBufferAsByteBuffer(FloatBuffer orig) {
+ public static ByteBuffer copyFloatBufferAsByteBuffer(final FloatBuffer orig) {
final int op0 = orig.position();
- ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_FLOAT);
+ final ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_FLOAT);
dest.asFloatBuffer().put(orig);
dest.rewind();
orig.position(op0);
@@ -646,9 +646,9 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static ByteBuffer copyIntBufferAsByteBuffer(IntBuffer orig) {
+ public static ByteBuffer copyIntBufferAsByteBuffer(final IntBuffer orig) {
final int op0 = orig.position();
- ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_INT);
+ final ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_INT);
dest.asIntBuffer().put(orig);
dest.rewind();
orig.position(op0);
@@ -663,9 +663,9 @@ public class Buffers {
* order. The position of the newly-allocated buffer will be zero,
* and the position of the passed buffer is unchanged.
*/
- public static ByteBuffer copyShortBufferAsByteBuffer(ShortBuffer orig) {
+ public static ByteBuffer copyShortBufferAsByteBuffer(final ShortBuffer orig) {
final int op0 = orig.position();
- ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_SHORT);
+ final ByteBuffer dest = newDirectByteBuffer(orig.remaining() * SIZEOF_SHORT);
dest.asShortBuffer().put(orig);
dest.rewind();
orig.position(op0);
@@ -684,7 +684,7 @@ public class Buffers {
* @param len the payload of elements to be copied, if <code>len < 0</code> then <code>len = source.length - soffset</code>
* @return the passed or newly created target array
*/
- public static float[] getFloatArray(double[] source, int soffset, float[] dest, int doffset, int len) {
+ public static float[] getFloatArray(final double[] source, final int soffset, float[] dest, int doffset, int len) {
if(0>len) {
len = source.length - soffset;
}
@@ -710,7 +710,7 @@ public class Buffers {
* @param dest the target buffer, if null, a new buffer is being created with size </code>source.remaining()</code>
* @return the passed or newly created target buffer
*/
- public static FloatBuffer getFloatBuffer(DoubleBuffer source, FloatBuffer dest) {
+ public static FloatBuffer getFloatBuffer(final DoubleBuffer source, FloatBuffer dest) {
if(null == dest) {
dest = newDirectFloatBuffer(source.remaining());
}
@@ -731,7 +731,7 @@ public class Buffers {
* @param len the payload of elements to be copied, if <code>len < 0</code> then <code>len = source.length - soffset</code>
* @return the passed or newly created target array
*/
- public static double[] getDoubleArray(float[] source, int soffset, double[] dest, int doffset, int len) {
+ public static double[] getDoubleArray(final float[] source, final int soffset, double[] dest, int doffset, int len) {
if(0>len) {
len = source.length - soffset;
}
@@ -757,7 +757,7 @@ public class Buffers {
* @param dest the target buffer, if null, a new buffer is being created with size </code>source.remaining()</code>
* @return the passed or newly created target buffer
*/
- public static DoubleBuffer getDoubleBuffer(FloatBuffer source, DoubleBuffer dest) {
+ public static DoubleBuffer getDoubleBuffer(final FloatBuffer source, DoubleBuffer dest) {
if(null == dest) {
dest = newDirectDoubleBuffer(source.remaining());
}
@@ -776,7 +776,7 @@ public class Buffers {
//
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B put(B dest, Buffer src) {
+ public static <B extends Buffer> B put(final B dest, final Buffer src) {
if ((dest instanceof ByteBuffer) && (src instanceof ByteBuffer)) {
return (B) ((ByteBuffer) dest).put((ByteBuffer) src);
} else if ((dest instanceof ShortBuffer) && (src instanceof ShortBuffer)) {
@@ -796,7 +796,7 @@ public class Buffers {
}
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putb(B dest, byte v) {
+ public static <B extends Buffer> B putb(final B dest, final byte v) {
if (dest instanceof ByteBuffer) {
return (B) ((ByteBuffer) dest).put(v);
} else if (dest instanceof ShortBuffer) {
@@ -817,7 +817,7 @@ public class Buffers {
}
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B puts(B dest, short v) {
+ public static <B extends Buffer> B puts(final B dest, final short v) {
if (dest instanceof ShortBuffer) {
return (B) ((ShortBuffer) dest).put(v);
} else if (dest instanceof IntBuffer) {
@@ -834,7 +834,7 @@ public class Buffers {
}
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B puti(B dest, int v) {
+ public static <B extends Buffer> B puti(final B dest, final int v) {
if (dest instanceof IntBuffer) {
return (B) ((IntBuffer) dest).put(v);
} else if (dest instanceof FloatBuffer) {
@@ -849,7 +849,7 @@ public class Buffers {
}
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putf(B dest, float v) {
+ public static <B extends Buffer> B putf(final B dest, final float v) {
if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put(v);
} else if (dest instanceof DoubleBuffer) {
@@ -864,7 +864,7 @@ public class Buffers {
}
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putd(B dest, double v) {
+ public static <B extends Buffer> B putd(final B dest, final double v) {
if (dest instanceof FloatBuffer) {
return (B) ((FloatBuffer) dest).put((float) v);
} else {
@@ -886,7 +886,7 @@ public class Buffers {
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
*/
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putNb(B dest, boolean dSigned, byte v, boolean sSigned) {
+ public static <B extends Buffer> B putNb(final B dest, final boolean dSigned, final byte v, final boolean sSigned) {
if (dest instanceof ByteBuffer) {
return (B) ((ByteBuffer) dest).put( v );
} else if (dest instanceof ShortBuffer) {
@@ -910,7 +910,7 @@ public class Buffers {
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
*/
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putNs(B dest, boolean dSigned, short v, boolean sSigned) {
+ public static <B extends Buffer> B putNs(final B dest, final boolean dSigned, final short v, final boolean sSigned) {
if (dest instanceof ByteBuffer) {
return (B) ((ByteBuffer) dest).put( ValueConv.short_to_byte(v, sSigned, dSigned) );
} else if (dest instanceof ShortBuffer) {
@@ -934,7 +934,7 @@ public class Buffers {
* @param sSigned true if source represents a signed value, false if source represents an unsigned value
*/
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putNi(B dest, boolean dSigned, int v, boolean sSigned) {
+ public static <B extends Buffer> B putNi(final B dest, final boolean dSigned, final int v, final boolean sSigned) {
if (dest instanceof ByteBuffer) {
return (B) ((ByteBuffer) dest).put( ValueConv.int_to_byte(v, sSigned, dSigned) );
} else if (dest instanceof ShortBuffer) {
@@ -957,7 +957,7 @@ public class Buffers {
* @param v source float value to be put in dest buffer
*/
@SuppressWarnings("unchecked")
- public static <B extends Buffer> B putNf(B dest, boolean dSigned, float v) {
+ public static <B extends Buffer> B putNf(final B dest, final boolean dSigned, final float v) {
if (dest instanceof ByteBuffer) {
return (B) ((ByteBuffer) dest).put( ValueConv.float_to_byte(v, dSigned) );
} else if (dest instanceof ShortBuffer) {
@@ -975,7 +975,7 @@ public class Buffers {
// Range check methods
//
- public static void rangeCheck(byte[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final byte[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -985,7 +985,7 @@ public class Buffers {
}
}
- public static void rangeCheck(char[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final char[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -995,7 +995,7 @@ public class Buffers {
}
}
- public static void rangeCheck(short[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final short[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -1005,7 +1005,7 @@ public class Buffers {
}
}
- public static void rangeCheck(int[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final int[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -1015,7 +1015,7 @@ public class Buffers {
}
}
- public static void rangeCheck(long[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final long[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -1025,7 +1025,7 @@ public class Buffers {
}
}
- public static void rangeCheck(float[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final float[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -1035,7 +1035,7 @@ public class Buffers {
}
}
- public static void rangeCheck(double[] array, int offset, int minElementsRemaining) {
+ public static void rangeCheck(final double[] array, final int offset, final int minElementsRemaining) {
if (array == null) {
return;
}
@@ -1045,7 +1045,7 @@ public class Buffers {
}
}
- public static void rangeCheck(Buffer buffer, int minElementsRemaining) {
+ public static void rangeCheck(final Buffer buffer, final int minElementsRemaining) {
if (buffer == null) {
return;
}
@@ -1061,7 +1061,7 @@ public class Buffers {
* @throws IllegalArgumentException if <code>buffer</code> is of invalid type.
* @throws IndexOutOfBoundsException if {@link #remainingBytes(Object)} is &lt; <code>minBytesRemaining<code>.
*/
- public static void rangeCheckBytes(Object buffer, int minBytesRemaining) throws IllegalArgumentException, IndexOutOfBoundsException {
+ public static void rangeCheckBytes(final Object buffer, final int minBytesRemaining) throws IllegalArgumentException, IndexOutOfBoundsException {
if (buffer == null) {
return;
}
@@ -1080,7 +1080,7 @@ public class Buffers {
* @param buffer Any valid Buffer instance
* @return the modified StringBuilder containing the Buffer details
*/
- public static StringBuilder toString(StringBuilder sb, String f, Buffer buffer) {
+ public static StringBuilder toString(StringBuilder sb, final String f, final Buffer buffer) {
if(null == sb) {
sb = new StringBuilder();
}
diff --git a/src/java/com/jogamp/common/nio/CachedBufferFactory.java b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
index 6ddff4a..073659c 100644
--- a/src/java/com/jogamp/common/nio/CachedBufferFactory.java
+++ b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
@@ -75,7 +75,7 @@ public class CachedBufferFactory {
this(DEFAULT_ALLOCATION_SIZE, DEFAULT_ALLOCATION_SIZE);
}
- private CachedBufferFactory(int initialSize, int allocationSize) {
+ private CachedBufferFactory(final int initialSize, final int allocationSize) {
currentBuffer = Buffers.newDirectByteBuffer(initialSize);
ALLOCATION_SIZE = allocationSize;
}
@@ -93,7 +93,7 @@ public class CachedBufferFactory {
* Creates a factory with the specified initial size. The allocation size is set to
* {@link #DEFAULT_ALLOCATION_SIZE}.
*/
- public static CachedBufferFactory create(int initialSize) {
+ public static CachedBufferFactory create(final int initialSize) {
return new CachedBufferFactory(initialSize, DEFAULT_ALLOCATION_SIZE);
}
@@ -103,14 +103,14 @@ public class CachedBufferFactory {
* @param fixed Creates a fixed size factory which will handle overflows (initial size)
* with RuntimeExceptions.
*/
- public static CachedBufferFactory create(int initialSize, boolean fixed) {
+ public static CachedBufferFactory create(final int initialSize, final boolean fixed) {
return new CachedBufferFactory(initialSize, fixed?-1:DEFAULT_ALLOCATION_SIZE);
}
/**
* Creates a factory with the specified initial size and allocation size.
*/
- public static CachedBufferFactory create(int initialSize, int allocationSize) {
+ public static CachedBufferFactory create(final int initialSize, final int allocationSize) {
return new CachedBufferFactory(initialSize, allocationSize);
}
@@ -125,21 +125,21 @@ public class CachedBufferFactory {
/**
* Synchronized version of {@link #create(int)}.
*/
- public static CachedBufferFactory createSynchronized(int initialSize) {
+ public static CachedBufferFactory createSynchronized(final int initialSize) {
return new SynchronizedCachedBufferFactory(initialSize, DEFAULT_ALLOCATION_SIZE);
}
/**
* Synchronized version of {@link #create(int, boolean)}.
*/
- public static CachedBufferFactory createSynchronized(int initialSize, boolean fixed) {
+ public static CachedBufferFactory createSynchronized(final int initialSize, final boolean fixed) {
return new SynchronizedCachedBufferFactory(initialSize, fixed?-1:DEFAULT_ALLOCATION_SIZE);
}
/**
* Synchronized version of {@link #create(int, int)}.
*/
- public static CachedBufferFactory createSynchronized(int initialSize, int allocationSize) {
+ public static CachedBufferFactory createSynchronized(final int initialSize, final int allocationSize) {
return new CachedBufferFactory(initialSize, allocationSize);
}
@@ -174,7 +174,7 @@ public class CachedBufferFactory {
currentBuffer = null;
}
}
- public ByteBuffer newDirectByteBuffer(int size) {
+ public ByteBuffer newDirectByteBuffer(final int size) {
// if large enough... just create it
if (size > currentBuffer.capacity()) {
@@ -189,123 +189,123 @@ public class CachedBufferFactory {
}
currentBuffer.limit(currentBuffer.position() + size);
- ByteBuffer result = currentBuffer.slice().order(currentBuffer.order());
+ final ByteBuffer result = currentBuffer.slice().order(currentBuffer.order());
currentBuffer.position(currentBuffer.limit());
currentBuffer.limit(currentBuffer.capacity());
return result;
}
- public ByteBuffer newDirectByteBuffer(byte[] values, int offset, int lenght) {
+ public ByteBuffer newDirectByteBuffer(final byte[] values, final int offset, final int lenght) {
return (ByteBuffer)newDirectByteBuffer(lenght).put(values, offset, lenght).rewind();
}
- public ByteBuffer newDirectByteBuffer(byte[] values, int offset) {
+ public ByteBuffer newDirectByteBuffer(final byte[] values, final int offset) {
return newDirectByteBuffer(values, offset, values.length-offset);
}
- public ByteBuffer newDirectByteBuffer(byte[] values) {
+ public ByteBuffer newDirectByteBuffer(final byte[] values) {
return newDirectByteBuffer(values, 0);
}
- public DoubleBuffer newDirectDoubleBuffer(int numElements) {
+ public DoubleBuffer newDirectDoubleBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_DOUBLE).asDoubleBuffer();
}
- public DoubleBuffer newDirectDoubleBuffer(double[] values, int offset, int lenght) {
+ public DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset, final int lenght) {
return (DoubleBuffer)newDirectDoubleBuffer(lenght).put(values, offset, lenght).rewind();
}
- public DoubleBuffer newDirectDoubleBuffer(double[] values, int offset) {
+ public DoubleBuffer newDirectDoubleBuffer(final double[] values, final int offset) {
return newDirectDoubleBuffer(values, offset, values.length - offset);
}
- public DoubleBuffer newDirectDoubleBuffer(double[] values) {
+ public DoubleBuffer newDirectDoubleBuffer(final double[] values) {
return newDirectDoubleBuffer(values, 0);
}
- public FloatBuffer newDirectFloatBuffer(int numElements) {
+ public FloatBuffer newDirectFloatBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_FLOAT).asFloatBuffer();
}
- public FloatBuffer newDirectFloatBuffer(float[] values, int offset, int lenght) {
+ public FloatBuffer newDirectFloatBuffer(final float[] values, final int offset, final int lenght) {
return (FloatBuffer)newDirectFloatBuffer(lenght).put(values, offset, lenght).rewind();
}
- public FloatBuffer newDirectFloatBuffer(float[] values, int offset) {
+ public FloatBuffer newDirectFloatBuffer(final float[] values, final int offset) {
return newDirectFloatBuffer(values, offset, values.length - offset);
}
- public FloatBuffer newDirectFloatBuffer(float[] values) {
+ public FloatBuffer newDirectFloatBuffer(final float[] values) {
return newDirectFloatBuffer(values, 0);
}
- public IntBuffer newDirectIntBuffer(int numElements) {
+ public IntBuffer newDirectIntBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_INT).asIntBuffer();
}
- public IntBuffer newDirectIntBuffer(int[] values, int offset, int lenght) {
+ public IntBuffer newDirectIntBuffer(final int[] values, final int offset, final int lenght) {
return (IntBuffer)newDirectIntBuffer(lenght).put(values, offset, lenght).rewind();
}
- public IntBuffer newDirectIntBuffer(int[] values, int offset) {
+ public IntBuffer newDirectIntBuffer(final int[] values, final int offset) {
return newDirectIntBuffer(values, offset, values.length - offset);
}
- public IntBuffer newDirectIntBuffer(int[] values) {
+ public IntBuffer newDirectIntBuffer(final int[] values) {
return newDirectIntBuffer(values, 0);
}
- public LongBuffer newDirectLongBuffer(int numElements) {
+ public LongBuffer newDirectLongBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_LONG).asLongBuffer();
}
- public LongBuffer newDirectLongBuffer(long[] values, int offset, int lenght) {
+ public LongBuffer newDirectLongBuffer(final long[] values, final int offset, final int lenght) {
return (LongBuffer)newDirectLongBuffer(lenght).put(values, offset, lenght).rewind();
}
- public LongBuffer newDirectLongBuffer(long[] values, int offset) {
+ public LongBuffer newDirectLongBuffer(final long[] values, final int offset) {
return newDirectLongBuffer(values, offset, values.length - offset);
}
- public LongBuffer newDirectLongBuffer(long[] values) {
+ public LongBuffer newDirectLongBuffer(final long[] values) {
return newDirectLongBuffer(values, 0);
}
- public ShortBuffer newDirectShortBuffer(int numElements) {
+ public ShortBuffer newDirectShortBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_SHORT).asShortBuffer();
}
- public ShortBuffer newDirectShortBuffer(short[] values, int offset, int lenght) {
+ public ShortBuffer newDirectShortBuffer(final short[] values, final int offset, final int lenght) {
return (ShortBuffer)newDirectShortBuffer(lenght).put(values, offset, lenght).rewind();
}
- public ShortBuffer newDirectShortBuffer(short[] values, int offset) {
+ public ShortBuffer newDirectShortBuffer(final short[] values, final int offset) {
return newDirectShortBuffer(values, offset, values.length - offset);
}
- public ShortBuffer newDirectShortBuffer(short[] values) {
+ public ShortBuffer newDirectShortBuffer(final short[] values) {
return newDirectShortBuffer(values, 0);
}
- public CharBuffer newDirectCharBuffer(int numElements) {
+ public CharBuffer newDirectCharBuffer(final int numElements) {
return newDirectByteBuffer(numElements * Buffers.SIZEOF_SHORT).asCharBuffer();
}
- public CharBuffer newDirectCharBuffer(char[] values, int offset, int lenght) {
+ public CharBuffer newDirectCharBuffer(final char[] values, final int offset, final int lenght) {
return (CharBuffer)newDirectCharBuffer(lenght).put(values, offset, lenght).rewind();
}
- public CharBuffer newDirectCharBuffer(char[] values, int offset) {
+ public CharBuffer newDirectCharBuffer(final char[] values, final int offset) {
return newDirectCharBuffer(values, offset, values.length - offset);
}
- public CharBuffer newDirectCharBuffer(char[] values) {
+ public CharBuffer newDirectCharBuffer(final char[] values) {
return newDirectCharBuffer(values, 0);
}
@Override
- public boolean equals(Object obj) {
+ public boolean equals(final Object obj) {
if (obj == null) {
return false;
}
@@ -335,12 +335,12 @@ public class CachedBufferFactory {
super();
}
- private SynchronizedCachedBufferFactory(int size, int step) {
+ private SynchronizedCachedBufferFactory(final int size, final int step) {
super(size, step);
}
@Override
- public synchronized ByteBuffer newDirectByteBuffer(int size) {
+ public synchronized ByteBuffer newDirectByteBuffer(final int size) {
return super.newDirectByteBuffer(size);
}
diff --git a/src/java/com/jogamp/common/nio/PointerBuffer.java b/src/java/com/jogamp/common/nio/PointerBuffer.java
index 5d470d5..e9138ac 100644
--- a/src/java/com/jogamp/common/nio/PointerBuffer.java
+++ b/src/java/com/jogamp/common/nio/PointerBuffer.java
@@ -57,17 +57,17 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
}
/** no backup array, use for direct usage only */
- static PointerBuffer create(ByteBuffer bb) {
+ static PointerBuffer create(final ByteBuffer bb) {
return Platform.is32Bit() ? new PointerBuffer( bb.asIntBuffer() ) : new PointerBuffer( bb.asLongBuffer() );
}
/** supports backup array */
- PointerBuffer(IntBuffer b) {
+ PointerBuffer(final IntBuffer b) {
super(b, ELEMENT_SIZE, b.capacity());
}
/** supports backup array */
- PointerBuffer(LongBuffer b) {
+ PointerBuffer(final LongBuffer b) {
super(b, ELEMENT_SIZE, b.capacity());
}
@@ -79,7 +79,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
}
/** Returns a non direct PointerBuffer in native order, having a backup array */
- public static PointerBuffer allocate(int size) {
+ public static PointerBuffer allocate(final int size) {
if (Platform.is32Bit()) {
return new PointerBuffer(IntBuffer.wrap(new int[size]));
} else {
@@ -88,11 +88,11 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
}
/** Returns a direct PointerBuffer in native order, w/o backup array */
- public static PointerBuffer allocateDirect(int size) {
+ public static PointerBuffer allocateDirect(final int size) {
return create(Buffers.newDirectByteBuffer(ELEMENT_SIZE * size));
}
- public static PointerBuffer wrap(ByteBuffer src) {
+ public static PointerBuffer wrap(final ByteBuffer src) {
return create(src);
}
@@ -118,7 +118,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
* 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>. */
@Override
- public final PointerBuffer put(PointerBuffer src) {
+ public final PointerBuffer put(final PointerBuffer src) {
if (remaining() < src.remaining()) {
throw new IndexOutOfBoundsException();
}
@@ -132,7 +132,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
final long addr = src.get();
put(addr);
if( null != src.dataMap) {
- Buffer bb = (Buffer) src.dataMap.get(addr);
+ final Buffer bb = (Buffer) src.dataMap.get(addr);
if(null!=bb) {
validateDataMap();
dataMap.put(addr, bb);
@@ -150,19 +150,19 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/** Relative get method. Get the pointer value at the current position and increment the position by one. */
@Override
public final long get() {
- long r = get(position);
+ final long r = get(position);
position++;
return r;
}
/** Absolute get method. Get the pointer value at the given index */
@Override
- public final long get(int idx) {
+ public final long get(final int idx) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
if (Platform.is32Bit()) {
- return (long) ((IntBuffer) buffer).get(idx) & 0x00000000FFFFFFFFL;
+ return ((IntBuffer) buffer).get(idx) & 0x00000000FFFFFFFFL;
} else {
return ((LongBuffer) buffer).get(idx);
}
@@ -172,7 +172,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
* 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 PointerBuffer get(long[] dest, int offset, int length) {
+ public final PointerBuffer get(final long[] dest, int offset, int length) {
if (dest.length<offset+length) {
throw new IndexOutOfBoundsException();
}
@@ -188,7 +188,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/** Absolute put method. Put the pointer value at the given index */
@Override
- public final PointerBuffer put(int idx, long v) {
+ public final PointerBuffer put(final int idx, final long v) {
if (0 > idx || idx >= capacity) {
throw new IndexOutOfBoundsException();
}
@@ -202,7 +202,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/** Relative put method. Put the pointer value at the current position and increment the position by one. */
@Override
- public final PointerBuffer put(long value) {
+ public final PointerBuffer put(final long value) {
put(position, value);
position++;
return this;
@@ -211,7 +211,7 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
/**
* 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 PointerBuffer put(long[] src, int offset, int length) {
+ public final PointerBuffer put(final long[] src, int offset, int length) {
if (src.length<offset+length) {
throw new IndexOutOfBoundsException();
}
@@ -231,15 +231,15 @@ public class PointerBuffer extends AbstractBuffer<PointerBuffer> {
@throws IllegalArgumentException if bb is null or not a direct buffer
*/
- public final PointerBuffer referenceBuffer(int index, Buffer bb) {
+ public final PointerBuffer referenceBuffer(final int index, final Buffer bb) {
if(null==bb) {
throw new IllegalArgumentException("Buffer is null");
}
if(!Buffers.isDirect(bb)) {
throw new IllegalArgumentException("Buffer is not direct");
}
- long mask = Platform.is32Bit() ? 0x00000000FFFFFFFFL : 0xFFFFFFFFFFFFFFFFL ;
- long bbAddr = getDirectBufferAddressImpl(bb) & mask;
+ final long mask = Platform.is32Bit() ? 0x00000000FFFFFFFFL : 0xFFFFFFFFFFFFFFFFL ;
+ final long bbAddr = getDirectBufferAddressImpl(bb) & mask;
if(0==bbAddr) {
throw new RuntimeException("Couldn't determine native address of given Buffer: "+bb);
}
@@ -252,22 +252,22 @@ public class PointerBuffer extends AbstractBuffer<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 final PointerBuffer referenceBuffer(Buffer bb) {
+ public final PointerBuffer referenceBuffer(final Buffer bb) {
referenceBuffer(position, bb);
position++;
return this;
}
- public final Buffer getReferencedBuffer(int index) {
+ public final Buffer getReferencedBuffer(final int index) {
if(null != dataMap) {
- long addr = get(index);
+ final long addr = get(index);
return (Buffer) dataMap.get(addr);
}
return null;
}
public final Buffer getReferencedBuffer() {
- Buffer bb = getReferencedBuffer(position);
+ final Buffer bb = getReferencedBuffer(position);
position++;
return bb;
}
diff --git a/src/java/com/jogamp/common/nio/StructAccessor.java b/src/java/com/jogamp/common/nio/StructAccessor.java
index b1593fe..af7b6d1 100644
--- a/src/java/com/jogamp/common/nio/StructAccessor.java
+++ b/src/java/com/jogamp/common/nio/StructAccessor.java
@@ -48,7 +48,7 @@ public class StructAccessor {
private final ByteBuffer bb;
- public StructAccessor(ByteBuffer bb) {
+ public StructAccessor(final ByteBuffer bb) {
// Setting of byte order is concession to native code which needs
// to instantiate these
this.bb = bb.order(ByteOrder.nativeOrder());
@@ -64,7 +64,7 @@ public class StructAccessor {
* bytes. Note that this method is not thread-safe with respect to
* the other methods in this class.
*/
- public final ByteBuffer slice(int byteOffset, int byteLength) {
+ public final ByteBuffer slice(final int byteOffset, final int byteLength) {
bb.position(byteOffset);
bb.limit(byteOffset + byteLength);
final ByteBuffer newBuf = bb.slice().order(bb.order()); // slice and duplicate may change byte order
@@ -74,47 +74,47 @@ public class StructAccessor {
}
/** Retrieves the byte at the specified byteOffset. */
- public final byte getByteAt(int byteOffset) {
+ public final byte getByteAt(final int byteOffset) {
return bb.get(byteOffset);
}
/** Puts a byte at the specified byteOffset. */
- public final void setByteAt(int byteOffset, byte v) {
+ public final void setByteAt(final int byteOffset, final byte v) {
bb.put(byteOffset, v);
}
/** Retrieves the char at the specified byteOffset. */
- public final char getCharAt(int byteOffset) {
+ public final char getCharAt(final int byteOffset) {
return bb.getChar(byteOffset);
}
/** Puts a char at the specified byteOffset. */
- public final void setCharAt(int byteOffset, char v) {
+ public final void setCharAt(final int byteOffset, final char v) {
bb.putChar(byteOffset, v);
}
/** Retrieves the short at the specified byteOffset. */
- public final short getShortAt(int byteOffset) {
+ public final short getShortAt(final int byteOffset) {
return bb.getShort(byteOffset);
}
/** Puts a short at the specified byteOffset. */
- public final void setShortAt(int byteOffset, short v) {
+ public final void setShortAt(final int byteOffset, final short v) {
bb.putShort(byteOffset, v);
}
/** Retrieves the int at the specified byteOffset. */
- public final int getIntAt(int byteOffset) {
+ public final int getIntAt(final int byteOffset) {
return bb.getInt(byteOffset);
}
/** Puts a int at the specified byteOffset. */
- public final void setIntAt(int byteOffset, int v) {
+ public final void setIntAt(final int byteOffset, final int v) {
bb.putInt(byteOffset, v);
}
/** Retrieves the int at the specified byteOffset. */
- public final int getIntAt(int byteOffset, int nativeSizeInBytes) {
+ public final int getIntAt(final int byteOffset, final int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
case 2:
return bb.getShort(byteOffset) & 0x0000FFFF ;
@@ -128,7 +128,7 @@ public class StructAccessor {
}
/** Puts a int at the specified byteOffset. */
- public final void setIntAt(int byteOffset, int v, int nativeSizeInBytes) {
+ public final void setIntAt(final int byteOffset, final int v, final int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
case 2:
bb.putShort(byteOffset, (short) ( v & 0x0000FFFF ) );
@@ -145,37 +145,37 @@ public class StructAccessor {
}
/** Retrieves the float at the specified byteOffset. */
- public final float getFloatAt(int byteOffset) {
+ public final float getFloatAt(final int byteOffset) {
return bb.getFloat(byteOffset);
}
/** Puts a float at the specified byteOffset. */
- public final void setFloatAt(int byteOffset, float v) {
+ public final void setFloatAt(final int byteOffset, final float v) {
bb.putFloat(byteOffset, v);
}
/** Retrieves the double at the specified byteOffset. */
- public final double getDoubleAt(int byteOffset) {
+ public final double getDoubleAt(final int byteOffset) {
return bb.getDouble(byteOffset);
}
/** Puts a double at the specified byteOffset. */
- public final void setDoubleAt(int byteOffset, double v) {
+ public final void setDoubleAt(final int byteOffset, final double v) {
bb.putDouble(byteOffset, v);
}
/** Retrieves the long at the specified byteOffset. */
- public final long getLongAt(int byteOffset) {
+ public final long getLongAt(final int byteOffset) {
return bb.getLong(byteOffset);
}
/** Puts a long at the specified byteOffset. */
- public final void setLongAt(int byteOffset, long v) {
+ public final void setLongAt(final int byteOffset, final long v) {
bb.putLong(byteOffset, v);
}
/** Retrieves the long at the specified byteOffset. */
- public final long getLongAt(int byteOffset, int nativeSizeInBytes) {
+ public final long getLongAt(final int byteOffset, final int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
case 4:
return bb.getInt(byteOffset) & 0x00000000FFFFFFFFL;
@@ -187,7 +187,7 @@ public class StructAccessor {
}
/** Puts a long at the specified byteOffset. */
- public final void setLongAt(int byteOffset, long v, int nativeSizeInBytes) {
+ public final void setLongAt(final int byteOffset, final long v, final int nativeSizeInBytes) {
switch(nativeSizeInBytes) {
case 4:
bb.putInt(byteOffset, (int) ( v & 0x00000000FFFFFFFFL ) );
@@ -200,91 +200,91 @@ public class StructAccessor {
}
}
- public final void setBytesAt(int byteOffset, byte[] v) {
+ public final void setBytesAt(int byteOffset, final byte[] v) {
for (int i = 0; i < v.length; i++) {
bb.put(byteOffset++, v[i]);
}
}
- public final byte[] getBytesAt(int byteOffset, byte[] v) {
+ public final byte[] getBytesAt(int byteOffset, final byte[] v) {
for (int i = 0; i < v.length; i++) {
v[i] = bb.get(byteOffset++);
}
return v;
}
- public final void setCharsAt(int byteOffset, char[] 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]);
}
}
- public final char[] getCharsAt(int byteOffset, char[] v) {
+ public final char[] getCharsAt(int byteOffset, final char[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
v[i] = bb.getChar(byteOffset);
}
return v;
}
- public final void setShortsAt(int byteOffset, short[] v) {
+ public final void setShortsAt(int byteOffset, final 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) {
+ public final short[] getShortsAt(int byteOffset, final short[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=2) {
v[i] = bb.getShort(byteOffset);
}
return v;
}
- public final void setIntsAt(int byteOffset, int[] v) {
+ public final void setIntsAt(int byteOffset, final int[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=4) {
bb.putInt(byteOffset, v[i]);
}
}
- public final int[] getIntsAt(int byteOffset, int[] v) {
+ public final int[] getIntsAt(int byteOffset, final int[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=4) {
v[i] = bb.getInt(byteOffset);
}
return v;
}
- public final void setFloatsAt(int byteOffset, float[] v) {
+ public final void setFloatsAt(int byteOffset, final float[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=4) {
bb.putFloat(byteOffset, v[i]);
}
}
- public final float[] getFloatsAt(int byteOffset, float[] v) {
+ public final float[] getFloatsAt(int byteOffset, final float[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=4) {
v[i] = bb.getFloat(byteOffset);
}
return v;
}
- public final void setDoublesAt(int byteOffset, double[] v) {
+ public final void setDoublesAt(int byteOffset, final double[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=8) {
bb.putDouble(byteOffset, v[i]);
}
}
- public final double[] getDoublesAt(int byteOffset, double[] v) {
+ public final double[] getDoublesAt(int byteOffset, final double[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=8) {
v[i] = bb.getDouble(byteOffset);
}
return v;
}
- public final void setLongsAt(int byteOffset, long[] v) {
+ public final void setLongsAt(int byteOffset, final long[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=8) {
bb.putLong(byteOffset, v[i]);
}
}
- public final long[] getLongsAt(int byteOffset, long[] v) {
+ public final long[] getLongsAt(int byteOffset, final long[] v) {
for (int i = 0; i < v.length; i++, byteOffset+=8) {
v[i] = bb.getLong(byteOffset);
}