com.jogamp.common.nio
Class StructAccessor

java.lang.Object
  extended by com.jogamp.common.nio.StructAccessor

public class StructAccessor
extends Object

Author:
Kenneth Russel, Michael Bien

Constructor Summary
StructAccessor(ByteBuffer bb)
           
 
Method Summary
 ByteBuffer getBuffer()
           
 byte getByteAt(int slot)
          Retrieves the byte at the specified slot (byte offset).
 byte[] getBytesAt(int slot, byte[] v)
           
 char getCharAt(int slot)
          Retrieves the char at the specified slot (2-byte offset).
 char[] getCharsAt(int slot, char[] v)
           
 double getDoubleAt(int slot)
          Retrieves the double at the specified slot (8-byte offset).
 double[] getDoublesAt(int slot, double[] v)
          Retrieves the long at the specified slot (8-byte offset).
 float getFloatAt(int slot)
          Retrieves the float at the specified slot (4-byte offset).
 float[] getFloatsAt(int slot, float[] v)
           
 int getIntAt(int slot)
          Retrieves the int at the specified slot (4-byte offset).
 int[] getIntsAt(int slot, int[] v)
           
 long getLongAt(int slot)
          Retrieves the long at the specified slot (8-byte offset).
 short getShortAt(int slot)
          Retrieves the short at the specified slot (2-byte offset).
 void setByteAt(int slot, byte v)
          Puts a byte at the specified slot (byte offset).
 void setBytesAt(int slot, byte[] v)
           
 void setCharAt(int slot, char v)
          Puts a char at the specified slot (2-byte offset).
 void setCharsAt(int slot, char[] v)
           
 void setDoubleAt(int slot, double v)
          Puts a double at the specified slot (8-byte offset).
 void setDoublesAt(int slot, double[] v)
          Puts a double at the specified slot (8-byte offset).
 void setFloatAt(int slot, float v)
          Puts a float at the specified slot (4-byte offset).
 void setFloatsAt(int slot, float[] v)
           
 void setIntAt(int slot, int v)
          Puts a int at the specified slot (4-byte offset).
 void setIntsAt(int slot, int[] v)
           
 void setLongAt(int slot, long v)
          Puts a long at the specified slot (8-byte offset).
 void setShortAt(int slot, short v)
          Puts a short at the specified slot (2-byte offset).
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructAccessor

public StructAccessor(ByteBuffer bb)
Method Detail

getBuffer

public ByteBuffer getBuffer()

slice

public 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 byte getByteAt(int slot)
Retrieves the byte at the specified slot (byte offset).


setByteAt

public void setByteAt(int slot,
                      byte v)
Puts a byte at the specified slot (byte offset).


getCharAt

public char getCharAt(int slot)
Retrieves the char at the specified slot (2-byte offset).


setCharAt

public void setCharAt(int slot,
                      char v)
Puts a char at the specified slot (2-byte offset).


getDoubleAt

public double getDoubleAt(int slot)
Retrieves the double at the specified slot (8-byte offset).


setDoubleAt

public void setDoubleAt(int slot,
                        double v)
Puts a double at the specified slot (8-byte offset).


getFloatAt

public float getFloatAt(int slot)
Retrieves the float at the specified slot (4-byte offset).


setFloatAt

public void setFloatAt(int slot,
                       float v)
Puts a float at the specified slot (4-byte offset).


getIntAt

public int getIntAt(int slot)
Retrieves the int at the specified slot (4-byte offset).


setIntAt

public void setIntAt(int slot,
                     int v)
Puts a int at the specified slot (4-byte offset).


getShortAt

public short getShortAt(int slot)
Retrieves the short at the specified slot (2-byte offset).


setShortAt

public void setShortAt(int slot,
                       short v)
Puts a short at the specified slot (2-byte offset).


setBytesAt

public void setBytesAt(int slot,
                       byte[] v)

getBytesAt

public byte[] getBytesAt(int slot,
                         byte[] v)

setCharsAt

public void setCharsAt(int slot,
                       char[] v)

getCharsAt

public char[] getCharsAt(int slot,
                         char[] v)

setIntsAt

public void setIntsAt(int slot,
                      int[] v)

getIntsAt

public int[] getIntsAt(int slot,
                       int[] v)

setFloatsAt

public void setFloatsAt(int slot,
                        float[] v)

getFloatsAt

public float[] getFloatsAt(int slot,
                           float[] v)

setDoublesAt

public void setDoublesAt(int slot,
                         double[] v)
Puts a double at the specified slot (8-byte offset). May throw an UnsupportedOperationException


getDoublesAt

public double[] getDoublesAt(int slot,
                             double[] v)
Retrieves the long at the specified slot (8-byte offset). May throw an UnsupportedOperationException


getLongAt

public long getLongAt(int slot)
Retrieves the long at the specified slot (8-byte offset).


setLongAt

public void setLongAt(int slot,
                      long v)
Puts a long at the specified slot (8-byte offset).