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 booleangetBooleanAt(int byteOffset)Retrieves the boolean at the specified byteOffset.boolean[]getBooleansAt(int byteOffset, boolean[] v)ByteBuffergetBuffer()Return the underlying native direct ByteBufferbytegetByteAt(int byteOffset)Retrieves the byte at the specified byteOffset.byte[]getBytesAt(int byteOffset, byte[] v)chargetCharAt(int byteOffset)Retrieves the char at the specified byteOffset.char[]getCharsAt(int byteOffset, char[] v)longgetDirectBufferAddress()Returns the native address of the underlying native ByteBuffer.doublegetDoubleAt(int byteOffset)Retrieves the double at the specified byteOffset.double[]getDoublesAt(int byteOffset, double[] v)floatgetFloatAt(int byteOffset)Retrieves the float at the specified byteOffset.float[]getFloatsAt(int byteOffset, float[] v)intgetIntAt(int byteOffset)Retrieves the int at the specified byteOffset.intgetIntAt(int byteOffset, int nativeSizeInBytes)Retrieves the int at the specified byteOffset.int[]getIntsAt(int byteOffset, int[] v)longgetLongAt(int byteOffset)Retrieves the long at the specified byteOffset.longgetLongAt(int byteOffset, int nativeSizeInBytes)Retrieves the long at the specified byteOffset.long[]getLongsAt(int byteOffset, long[] v)shortgetShortAt(int byteOffset)Retrieves the short at the specified byteOffset.short[]getShortsAt(int byteOffset, short[] v)voidsetBooleanAt(int byteOffset, boolean v)Puts a boolean at the specified byteOffset.voidsetBooleansAt(int byteOffset, boolean[] v)voidsetByteAt(int byteOffset, byte v)Puts a byte at the specified byteOffset.voidsetBytesAt(int byteOffset, byte[] v)voidsetCharAt(int byteOffset, char v)Puts a char at the specified byteOffset.voidsetCharsAt(int byteOffset, char[] v)voidsetDoubleAt(int byteOffset, double v)Puts a double at the specified byteOffset.voidsetDoublesAt(int byteOffset, double[] v)voidsetFloatAt(int byteOffset, float v)Puts a float at the specified byteOffset.voidsetFloatsAt(int byteOffset, float[] v)voidsetIntAt(int byteOffset, int v)Puts a int at the specified byteOffset.voidsetIntAt(int byteOffset, int v, int nativeSizeInBytes)Puts a int at the specified byteOffset.voidsetIntsAt(int byteOffset, int[] v)voidsetLongAt(int byteOffset, long v)Puts a long at the specified byteOffset.voidsetLongAt(int byteOffset, long v, int nativeSizeInBytes)Puts a long at the specified byteOffset.voidsetLongsAt(int byteOffset, long[] v)voidsetShortAt(int byteOffset, short v)Puts a short at the specified byteOffset.voidsetShortsAt(int byteOffset, short[] v)ByteBufferslice(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. TheByteBufferwill 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)
-
-