javax.media.j3d
Class J3DBuffer

java.lang.Object
  extended by javax.media.j3d.J3DBuffer

public class J3DBuffer
extends java.lang.Object

Java 3D wrapper class for java.nio.Buffer objects. When used to wrap a non-null NIO buffer object, this class will create a read-only view of the wrapped NIO buffer, and will call rewind on the read-only view, so that elements 0 through buffer.limit()-1 will be available internally.

Since:
Java 3D 1.3
See Also:
GeometryArray.setCoordRefBuffer(J3DBuffer), GeometryArray.setColorRefBuffer(J3DBuffer), GeometryArray.setNormalRefBuffer(J3DBuffer), GeometryArray.setTexCoordRefBuffer(int,J3DBuffer), GeometryArray.setVertexAttrRefBuffer(int,J3DBuffer), GeometryArray.setInterleavedVertexBuffer(J3DBuffer), CompressedGeometry.CompressedGeometry(CompressedGeometryHeader,J3DBuffer)

Field Summary
private  BufferWrapper bufferImpl
           
private  int bufferType
           
private  java.nio.Buffer originalBuffer
           
(package private) static int TYPE_BYTE
           
(package private) static int TYPE_CHAR
           
(package private) static int TYPE_DOUBLE
           
(package private) static int TYPE_FLOAT
           
(package private) static int TYPE_INT
           
(package private) static int TYPE_LONG
           
(package private) static int TYPE_NULL
           
(package private) static int TYPE_SHORT
           
(package private) static int TYPE_UNKNOWN
           
(package private) static boolean unsupportedOperation
           
 
Constructor Summary
J3DBuffer()
          Constructs a J3DBuffer object and initializes it with a null NIO buffer object.
J3DBuffer(java.nio.Buffer buffer)
          Constructs a J3DBuffer object and initializes it with the specified NIO buffer object.
 
Method Summary
private static boolean checkNativeBufferAccess(java.nio.Buffer buffer)
           
 java.nio.Buffer getBuffer()
          Retrieves the NIO buffer object from this J3DBuffer.
(package private)  BufferWrapper getBufferImpl()
           
(package private)  int getBufferType()
           
 void setBuffer(java.nio.Buffer buffer)
          Sets the NIO buffer object in this J3DBuffer to the specified object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_NULL

static final int TYPE_NULL
See Also:
Constant Field Values

TYPE_UNKNOWN

static final int TYPE_UNKNOWN
See Also:
Constant Field Values

TYPE_BYTE

static final int TYPE_BYTE
See Also:
Constant Field Values

TYPE_CHAR

static final int TYPE_CHAR
See Also:
Constant Field Values

TYPE_SHORT

static final int TYPE_SHORT
See Also:
Constant Field Values

TYPE_INT

static final int TYPE_INT
See Also:
Constant Field Values

TYPE_LONG

static final int TYPE_LONG
See Also:
Constant Field Values

TYPE_FLOAT

static final int TYPE_FLOAT
See Also:
Constant Field Values

TYPE_DOUBLE

static final int TYPE_DOUBLE
See Also:
Constant Field Values

unsupportedOperation

static boolean unsupportedOperation

originalBuffer

private java.nio.Buffer originalBuffer

bufferImpl

private BufferWrapper bufferImpl

bufferType

private int bufferType
Constructor Detail

J3DBuffer

public J3DBuffer()
Constructs a J3DBuffer object and initializes it with a null NIO buffer object. The NIO buffer object must be set to a non-null value before using this J3DBuffer object in a Java 3D node component.

Throws:
java.lang.UnsupportedOperationException - if the JVM does not support native access to direct NIO buffers

J3DBuffer

public J3DBuffer(java.nio.Buffer buffer)
Constructs a J3DBuffer object and initializes it with the specified NIO buffer object.

Parameters:
buffer - the NIO buffer wrapped by this J3DBuffer
Throws:
java.lang.UnsupportedOperationException - if the JVM does not support native access to direct NIO buffers
java.lang.IllegalArgumentException - if the specified buffer is not a direct buffer, or if the byte order of the specified buffer does not match the native byte order of the underlying platform.
Method Detail

setBuffer

public void setBuffer(java.nio.Buffer buffer)
Sets the NIO buffer object in this J3DBuffer to the specified object.

Parameters:
buffer - the NIO buffer wrapped by this J3DBuffer
Throws:
java.lang.IllegalArgumentException - if the specified buffer is not a direct buffer, or if the byte order of the specified buffer does not match the native byte order of the underlying platform.

getBuffer

public java.nio.Buffer getBuffer()
Retrieves the NIO buffer object from this J3DBuffer.

Returns:
the current NIO buffer wrapped by this J3DBuffer

getBufferType

int getBufferType()

getBufferImpl

BufferWrapper getBufferImpl()

checkNativeBufferAccess

private static boolean checkNativeBufferAccess(java.nio.Buffer buffer)


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.