com.sun.opengl.util
Class BufferUtil

java.lang.Object
  extended by com.sun.opengl.util.BufferUtil

public class BufferUtil
extends java.lang.Object

Utility routines for dealing with direct buffers.


Field Summary
static int SIZEOF_BYTE
           
static int SIZEOF_DOUBLE
           
static int SIZEOF_FLOAT
           
static int SIZEOF_INT
           
static int SIZEOF_LONG
           
static int SIZEOF_SHORT
           
 
Method Summary
static java.nio.ByteBuffer copyByteBuffer(java.nio.ByteBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed ByteBuffer into a newly-allocated direct ByteBuffer.
static java.nio.DoubleBuffer copyDoubleBuffer(java.nio.DoubleBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed DoubleBuffer into a newly-allocated direct DoubleBuffer.
static java.nio.ByteBuffer copyDoubleBufferAsByteBuffer(java.nio.DoubleBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed DoubleBuffer into a newly-allocated direct ByteBuffer.
static java.nio.FloatBuffer copyFloatBuffer(java.nio.FloatBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed FloatBuffer into a newly-allocated direct FloatBuffer.
static java.nio.ByteBuffer copyFloatBufferAsByteBuffer(java.nio.FloatBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed FloatBuffer into a newly-allocated direct ByteBuffer.
static java.nio.IntBuffer copyIntBuffer(java.nio.IntBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed IntBuffer into a newly-allocated direct IntBuffer.
static java.nio.ByteBuffer copyIntBufferAsByteBuffer(java.nio.IntBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed IntBuffer into a newly-allocated direct ByteBuffer.
static java.nio.LongBuffer copyLongBuffer(java.nio.LongBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed LongBuffer into a newly-allocated direct LongBuffer.
static java.nio.ByteBuffer copyLongBufferAsByteBuffer(java.nio.LongBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed LongBuffer into a newly-allocated direct ByteBuffer.
static java.nio.ShortBuffer copyShortBuffer(java.nio.ShortBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed ShortBuffer into a newly-allocated direct ShortBuffer.
static java.nio.ByteBuffer copyShortBufferAsByteBuffer(java.nio.ShortBuffer orig)
          Copies the remaining elements (as defined by limit() - position()) in the passed ShortBuffer into a newly-allocated direct ByteBuffer.
static java.nio.ByteBuffer newByteBuffer(int numElements)
          Allocates a new direct ByteBuffer with the specified number of elements.
static java.nio.DoubleBuffer newDoubleBuffer(int numElements)
          Allocates a new direct DoubleBuffer with the specified number of elements.
static java.nio.FloatBuffer newFloatBuffer(int numElements)
          Allocates a new direct FloatBuffer with the specified number of elements.
static java.nio.IntBuffer newIntBuffer(int numElements)
          Allocates a new direct IntBuffer with the specified number of elements.
static java.nio.LongBuffer newLongBuffer(int numElements)
          Allocates a new direct LongBuffer with the specified number of elements.
static java.nio.ShortBuffer newShortBuffer(int numElements)
          Allocates a new direct ShortBuffer with the specified number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZEOF_BYTE

public static final int SIZEOF_BYTE
See Also:
Constant Field Values

SIZEOF_SHORT

public static final int SIZEOF_SHORT
See Also:
Constant Field Values

SIZEOF_INT

public static final int SIZEOF_INT
See Also:
Constant Field Values

SIZEOF_FLOAT

public static final int SIZEOF_FLOAT
See Also:
Constant Field Values

SIZEOF_LONG

public static final int SIZEOF_LONG
See Also:
Constant Field Values

SIZEOF_DOUBLE

public static final int SIZEOF_DOUBLE
See Also:
Constant Field Values
Method Detail

newByteBuffer

public static java.nio.ByteBuffer newByteBuffer(int numElements)
Allocates a new direct ByteBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


newDoubleBuffer

public static java.nio.DoubleBuffer newDoubleBuffer(int numElements)
Allocates a new direct DoubleBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


newFloatBuffer

public static java.nio.FloatBuffer newFloatBuffer(int numElements)
Allocates a new direct FloatBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


newIntBuffer

public static java.nio.IntBuffer newIntBuffer(int numElements)
Allocates a new direct IntBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


newLongBuffer

public static java.nio.LongBuffer newLongBuffer(int numElements)
Allocates a new direct LongBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


newShortBuffer

public static java.nio.ShortBuffer newShortBuffer(int numElements)
Allocates a new direct ShortBuffer with the specified number of elements. The returned buffer will have its byte order set to the host platform's native byte order.


copyByteBuffer

public static java.nio.ByteBuffer copyByteBuffer(java.nio.ByteBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed ByteBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyDoubleBuffer

public static java.nio.DoubleBuffer copyDoubleBuffer(java.nio.DoubleBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed DoubleBuffer into a newly-allocated direct DoubleBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyFloatBuffer

public static java.nio.FloatBuffer copyFloatBuffer(java.nio.FloatBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed FloatBuffer into a newly-allocated direct FloatBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyIntBuffer

public static java.nio.IntBuffer copyIntBuffer(java.nio.IntBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed IntBuffer into a newly-allocated direct IntBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyLongBuffer

public static java.nio.LongBuffer copyLongBuffer(java.nio.LongBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed LongBuffer into a newly-allocated direct LongBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyShortBuffer

public static java.nio.ShortBuffer copyShortBuffer(java.nio.ShortBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed ShortBuffer into a newly-allocated direct ShortBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyDoubleBufferAsByteBuffer

public static java.nio.ByteBuffer copyDoubleBufferAsByteBuffer(java.nio.DoubleBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed DoubleBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyFloatBufferAsByteBuffer

public static java.nio.ByteBuffer copyFloatBufferAsByteBuffer(java.nio.FloatBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed FloatBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyIntBufferAsByteBuffer

public static java.nio.ByteBuffer copyIntBufferAsByteBuffer(java.nio.IntBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed IntBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyLongBufferAsByteBuffer

public static java.nio.ByteBuffer copyLongBufferAsByteBuffer(java.nio.LongBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed LongBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).


copyShortBufferAsByteBuffer

public static java.nio.ByteBuffer copyShortBufferAsByteBuffer(java.nio.ShortBuffer orig)
Copies the remaining elements (as defined by limit() - position()) in the passed ShortBuffer into a newly-allocated direct ByteBuffer. The returned buffer will have its byte order set to the host platform's native byte order. The position of the newly-allocated buffer will be zero, and the position of the passed buffer is unchanged (though its mark is changed).



Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.