Package com.jogamp.common.nio
Class StructAccessor
- java.lang.Object
-
- com.jogamp.common.nio.StructAccessor
-
public class StructAccessor extends Object
- Author:
- Kenneth Russel, Sven Gothel, Michael Bien, et al.
-
-
Constructor Summary
Constructors Constructor Description StructAccessor(ByteBuffer bb)
Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getBooleanAt(int byteOffset)
Retrieves the boolean at the specified byteOffset.boolean[]
getBooleansAt(int byteOffset, boolean[] v)
ByteBuffer
getBuffer()
Return the underlying native direct ByteBufferbyte
getByteAt(int byteOffset)
Retrieves the byte at the specified byteOffset.byte[]
getBytesAt(int byteOffset, byte[] v)
char
getCharAt(int byteOffset)
Retrieves the char at the specified byteOffset.char[]
getCharsAt(int byteOffset, char[] v)
long
getDirectBufferAddress()
Returns the native address of the underlying native ByteBuffer.double
getDoubleAt(int byteOffset)
Retrieves the double at the specified byteOffset.double[]
getDoublesAt(int byteOffset, double[] v)
float
getFloatAt(int byteOffset)
Retrieves the float at the specified byteOffset.float[]
getFloatsAt(int byteOffset, float[] v)
int
getIntAt(int byteOffset)
Retrieves the int at the specified byteOffset.int
getIntAt(int byteOffset, int nativeSizeInBytes)
Retrieves the int at the specified byteOffset.int[]
getIntsAt(int byteOffset, int[] v)
long
getLongAt(int byteOffset)
Retrieves the long at the specified byteOffset.long
getLongAt(int byteOffset, int nativeSizeInBytes)
Retrieves the long at the specified byteOffset.long[]
getLongsAt(int byteOffset, long[] v)
short
getShortAt(int byteOffset)
Retrieves the short at the specified byteOffset.short[]
getShortsAt(int byteOffset, short[] v)
void
setBooleanAt(int byteOffset, boolean v)
Puts a boolean at the specified byteOffset.void
setBooleansAt(int byteOffset, boolean[] v)
void
setByteAt(int byteOffset, byte v)
Puts a byte at the specified byteOffset.void
setBytesAt(int byteOffset, byte[] v)
void
setCharAt(int byteOffset, char v)
Puts a char at the specified byteOffset.void
setCharsAt(int byteOffset, char[] v)
void
setDoubleAt(int byteOffset, double v)
Puts a double at the specified byteOffset.void
setDoublesAt(int byteOffset, double[] v)
void
setFloatAt(int byteOffset, float v)
Puts a float at the specified byteOffset.void
setFloatsAt(int byteOffset, float[] v)
void
setIntAt(int byteOffset, int v)
Puts a int at the specified byteOffset.void
setIntAt(int byteOffset, int v, int nativeSizeInBytes)
Puts a int at the specified byteOffset.void
setIntsAt(int byteOffset, int[] v)
void
setLongAt(int byteOffset, long v)
Puts a long at the specified byteOffset.void
setLongAt(int byteOffset, long v, int nativeSizeInBytes)
Puts a long at the specified byteOffset.void
setLongsAt(int byteOffset, long[] v)
void
setShortAt(int byteOffset, short v)
Puts a short at the specified byteOffset.void
setShortsAt(int byteOffset, short[] v)
ByteBuffer
slice(int byteOffset, int byteLength)
Returns a slice of the current ByteBuffer starting at the specified byte offset and extending the specified number of bytes.
-
-
-
Constructor Detail
-
StructAccessor
public StructAccessor(ByteBuffer bb)
Create a new instance. TheByteBuffer
will beByteBuffer.rewind()
and native-order to be used with native code set.
-
-
Method Detail
-
getBuffer
public final ByteBuffer getBuffer()
Return the underlying native direct ByteBuffer
-
getDirectBufferAddress
public final long getDirectBufferAddress()
Returns the native address of the underlying native ByteBuffer.
-
slice
public final ByteBuffer slice(int byteOffset, int byteLength)
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 the other methods in this class.
-
getByteAt
public final byte getByteAt(int byteOffset)
Retrieves the byte at the specified byteOffset.
-
setByteAt
public final void setByteAt(int byteOffset, byte v)
Puts a byte at the specified byteOffset.
-
getBooleanAt
public final boolean getBooleanAt(int byteOffset)
Retrieves the boolean at the specified byteOffset.
-
setBooleanAt
public final void setBooleanAt(int byteOffset, boolean v)
Puts a boolean at the specified byteOffset.
-
getCharAt
public final char getCharAt(int byteOffset)
Retrieves the char at the specified byteOffset.
-
setCharAt
public final void setCharAt(int byteOffset, char v)
Puts a char at the specified byteOffset.
-
getShortAt
public final short getShortAt(int byteOffset)
Retrieves the short at the specified byteOffset.
-
setShortAt
public final void setShortAt(int byteOffset, short v)
Puts a short at the specified byteOffset.
-
getIntAt
public final int getIntAt(int byteOffset)
Retrieves the int at the specified byteOffset.
-
setIntAt
public final void setIntAt(int byteOffset, int v)
Puts a int at the specified byteOffset.
-
getIntAt
public final int getIntAt(int byteOffset, int nativeSizeInBytes)
Retrieves the int at the specified byteOffset.
-
setIntAt
public final void setIntAt(int byteOffset, int v, int nativeSizeInBytes)
Puts a int at the specified byteOffset.
-
getFloatAt
public final float getFloatAt(int byteOffset)
Retrieves the float at the specified byteOffset.
-
setFloatAt
public final void setFloatAt(int byteOffset, float v)
Puts a float at the specified byteOffset.
-
getDoubleAt
public final double getDoubleAt(int byteOffset)
Retrieves the double at the specified byteOffset.
-
setDoubleAt
public final void setDoubleAt(int byteOffset, double v)
Puts a double at the specified byteOffset.
-
getLongAt
public final long getLongAt(int byteOffset)
Retrieves the long at the specified byteOffset.
-
setLongAt
public final void setLongAt(int byteOffset, long v)
Puts a long at the specified byteOffset.
-
getLongAt
public final long getLongAt(int byteOffset, int nativeSizeInBytes)
Retrieves the long at the specified byteOffset.
-
setLongAt
public final void setLongAt(int byteOffset, long v, int nativeSizeInBytes)
Puts a long at the specified byteOffset.
-
setBytesAt
public final void setBytesAt(int byteOffset, byte[] v)
-
getBytesAt
public final byte[] getBytesAt(int byteOffset, byte[] v)
-
setBooleansAt
public final void setBooleansAt(int byteOffset, boolean[] v)
-
getBooleansAt
public final boolean[] getBooleansAt(int byteOffset, boolean[] v)
-
setCharsAt
public final void setCharsAt(int byteOffset, char[] v)
-
getCharsAt
public final char[] getCharsAt(int byteOffset, char[] v)
-
setShortsAt
public final void setShortsAt(int byteOffset, short[] v)
-
getShortsAt
public final short[] getShortsAt(int byteOffset, short[] v)
-
setIntsAt
public final void setIntsAt(int byteOffset, int[] v)
-
getIntsAt
public final int[] getIntsAt(int byteOffset, int[] v)
-
setFloatsAt
public final void setFloatsAt(int byteOffset, float[] v)
-
getFloatsAt
public final float[] getFloatsAt(int byteOffset, float[] v)
-
setDoublesAt
public final void setDoublesAt(int byteOffset, double[] v)
-
getDoublesAt
public final double[] getDoublesAt(int byteOffset, double[] v)
-
setLongsAt
public final void setLongsAt(int byteOffset, long[] v)
-
getLongsAt
public final long[] getLongsAt(int byteOffset, long[] v)
-
-