com.sun.j3d.utils.scenegraph.io.retained
Class Controller

java.lang.Object
  extended by com.sun.j3d.utils.scenegraph.io.retained.Controller
Direct Known Subclasses:
RandomAccessFileControl, StreamControl

public abstract class Controller
extends java.lang.Object

Provides code to control the reading and writing of Java3D objects to and from any Java IO mechanism.


Constructor Summary
Controller()
          Creates new Controller
 
Method Summary
 void addNamedObject(java.lang.String name, javax.media.j3d.SceneGraphObject object)
          Associate the name with the scene graph object
abstract  void close()
           
 SceneGraphObjectState createState(javax.media.j3d.SceneGraphObject obj)
          Create a new state object and check for a pre-existing symbol table entry
 SceneGraphObjectState createState(javax.media.j3d.SceneGraphObject obj, SymbolTableData symbol)
          Given a scene graph object instantiate the correct State class for that object.
 SceneGraphObjectState createState(SymbolTableData symbol)
          Return the state class for the SceneGraphObject, creating one if it does not already exist
 java.lang.ClassLoader getClassLoader()
          Get the class loader used to load the Scene Graph Objects and the serialized user data.
 int getCurrentFileVersion()
          Get the file version of the file we are reading
abstract  long getFilePointer()
          Get the current file 'pointer' location.
 int getImageCompression()
          Returns the imageCompression to be used IMAGE_COMPRESSION_NONE, IMAGE_COMPRESSION_GZIP, IMAGE_COMPRESSION_JPEG
 javax.media.j3d.SceneGraphObject getNamedObject(java.lang.String name)
          Return the SceneGraphObject associated with the name
 java.lang.String[] getNames()
          Get all the names of the named objects
 java.lang.Class getNodeClassFromID(int classID)
           
 int getNodeClassID(javax.media.j3d.SceneGraphObject node)
           
 int getOutputFileVersion()
          Get the file version that we should write
 SymbolTable getSymbolTable()
           
 javax.media.j3d.Bounds readBounds(java.io.DataInput in)
           
 javax.vecmath.Color3f readColor3f(java.io.DataInput in)
           
 javax.vecmath.Color4f readColor4f(java.io.DataInput in)
           
 javax.vecmath.Matrix4d readMatrix4d(java.io.DataInput in)
           
 SceneGraphObjectState readObject(java.io.DataInput in)
           
 javax.vecmath.Point3d readPoint3d(java.io.DataInput in)
           
 javax.vecmath.Point3f readPoint3f(java.io.DataInput in)
           
 javax.vecmath.Quat4f readQuat4f(java.io.DataInput in)
           
 java.lang.Object readSerializedData(java.io.DataInput dataInput)
           
 int readSharedGroup(java.io.DataInput in)
          Read a Shared group and it's node components from the IO Stream
 javax.media.j3d.Transform3D readTransform3D(java.io.DataInput in)
           
 javax.vecmath.Tuple3d readTuple3d(java.io.DataInput in, javax.vecmath.Tuple3d tuple)
           
 javax.vecmath.Tuple3f readTuple3f(java.io.DataInput in, javax.vecmath.Tuple3f tuple)
           
 javax.vecmath.Tuple4d readTuple4d(java.io.DataInput in, javax.vecmath.Tuple4d tuple)
           
 javax.vecmath.Tuple4f readTuple4f(java.io.DataInput in, javax.vecmath.Tuple4f tuple)
           
 ConfiguredUniverse readUniverse(java.io.DataInput in, boolean attachBranchGraphs, javax.media.j3d.Canvas3D canvas)
          Read and create a new Universe matching the one used during save.
 javax.vecmath.Vector3f readVector3f(java.io.DataInput in)
           
 javax.vecmath.Vector4d readVector4d(java.io.DataInput in)
           
 javax.vecmath.Vector4f readVector4f(java.io.DataInput in)
           
 void reset()
          Reset the controller, ready to load/save data to a new file
 void setClassLoader(java.lang.ClassLoader classLoader)
          Set the class loader used to load the Scene Graph Objects and the serialized user data.
 void skipUserData(java.io.DataInput dataInput)
          Skip past the user data object
 boolean useSuperClassIfNoChildClass()
          Indicates to SceneGraphObjectState that it should use the Java3D core superclass for any tree nodes whose classes are not in the classpath during a load.
 void writeBounds(java.io.DataOutput out, javax.media.j3d.Bounds bounds)
           
abstract  void writeBranchGraph(javax.media.j3d.BranchGroup bg, java.io.Serializable userData)
           
 void writeColor3f(java.io.DataOutput out, javax.vecmath.Color3f color)
           
 void writeColor4f(java.io.DataOutput out, javax.vecmath.Color4f vec)
           
 void writeMatrix4d(java.io.DataOutput out, javax.vecmath.Matrix4d m)
           
 void writeObject(java.io.DataOutput out, SceneGraphObjectState obj)
           
 void writePoint3d(java.io.DataOutput out, javax.vecmath.Point3d pt)
           
 void writePoint3f(java.io.DataOutput out, javax.vecmath.Point3f pt)
           
 void writeQuat4f(java.io.DataOutput out, javax.vecmath.Quat4f vec)
           
 void writeSerializedData(java.io.DataOutput dataOutput, java.io.Serializable userData)
          Write a serializable object to the current file position, proceeded by the size of the object
 void writeSharedGroup(java.io.DataOutput out, javax.media.j3d.SharedGroup sharedGroup, SymbolTableData symbol)
          Write the shared group and it's node components to the IO stream
 void writeTransform3D(java.io.DataOutput out, javax.media.j3d.Transform3D tran)
           
 void writeTuple3d(java.io.DataOutput out, javax.vecmath.Tuple3d tuple)
           
 void writeTuple3f(java.io.DataOutput out, javax.vecmath.Tuple3f tuple)
           
 void writeTuple4d(java.io.DataOutput out, javax.vecmath.Tuple4d tuple)
           
 void writeTuple4f(java.io.DataOutput out, javax.vecmath.Tuple4f tuple)
           
 void writeUniverse(java.io.DataOutput out, SimpleUniverse universe, boolean writeUniverseContent)
          Write out the Universe information.
 void writeVector3f(java.io.DataOutput out, javax.vecmath.Vector3f vec)
           
 void writeVector4d(java.io.DataOutput out, javax.vecmath.Vector4d vec)
           
 void writeVector4f(java.io.DataOutput out, javax.vecmath.Vector4f vec)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Controller

public Controller()
Creates new Controller

Method Detail

getSymbolTable

public final SymbolTable getSymbolTable()

getOutputFileVersion

public int getOutputFileVersion()
Get the file version that we should write


getCurrentFileVersion

public int getCurrentFileVersion()
Get the file version of the file we are reading


createState

public SceneGraphObjectState createState(javax.media.j3d.SceneGraphObject obj)
Create a new state object and check for a pre-existing symbol table entry


createState

public SceneGraphObjectState createState(javax.media.j3d.SceneGraphObject obj,
                                         SymbolTableData symbol)
Given a scene graph object instantiate the correct State class for that object. If the symbol already exists (is not null) then increment the reference count, otherwise create a new symbol.


createState

public SceneGraphObjectState createState(SymbolTableData symbol)
Return the state class for the SceneGraphObject, creating one if it does not already exist


writeObject

public void writeObject(java.io.DataOutput out,
                        SceneGraphObjectState obj)
                 throws java.io.IOException
Throws:
java.io.IOException

readObject

public SceneGraphObjectState readObject(java.io.DataInput in)
                                 throws java.io.IOException
Throws:
java.io.IOException

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Set the class loader used to load the Scene Graph Objects and the serialized user data. The default is ClassLoader.getSystemClassLoader()


getClassLoader

public java.lang.ClassLoader getClassLoader()
Get the class loader used to load the Scene Graph Objects and the serialized user data. The default is ClassLoader.getSystemClassLoader()


writeSharedGroup

public void writeSharedGroup(java.io.DataOutput out,
                             javax.media.j3d.SharedGroup sharedGroup,
                             SymbolTableData symbol)
                      throws java.io.IOException
Write the shared group and it's node components to the IO stream

Throws:
java.io.IOException

readSharedGroup

public int readSharedGroup(java.io.DataInput in)
                    throws java.io.IOException
Read a Shared group and it's node components from the IO Stream

Throws:
java.io.IOException

writeUniverse

public void writeUniverse(java.io.DataOutput out,
                          SimpleUniverse universe,
                          boolean writeUniverseContent)
                   throws java.io.IOException,
                          UnsupportedUniverseException,
                          javax.media.j3d.CapabilityNotSetException
Write out the Universe information.

Throws:
java.io.IOException
UnsupportedUniverseException
javax.media.j3d.CapabilityNotSetException

readUniverse

public ConfiguredUniverse readUniverse(java.io.DataInput in,
                                       boolean attachBranchGraphs,
                                       javax.media.j3d.Canvas3D canvas)
                                throws java.io.IOException
Read and create a new Universe matching the one used during save.

Parameters:
attachBranchGraphs - If true then all the branchGraph attached to the universe when it was saved will be loaded and reattached.
Throws:
java.io.IOException

writeBranchGraph

public abstract void writeBranchGraph(javax.media.j3d.BranchGroup bg,
                                      java.io.Serializable userData)
                               throws java.io.IOException
Throws:
java.io.IOException

reset

public void reset()
Reset the controller, ready to load/save data to a new file


getNodeClassFromID

public java.lang.Class getNodeClassFromID(int classID)

getNodeClassID

public int getNodeClassID(javax.media.j3d.SceneGraphObject node)

addNamedObject

public void addNamedObject(java.lang.String name,
                           javax.media.j3d.SceneGraphObject object)
Associate the name with the scene graph object


getNamedObject

public javax.media.j3d.SceneGraphObject getNamedObject(java.lang.String name)
                                                throws NamedObjectException,
                                                       ObjectNotLoadedException
Return the SceneGraphObject associated with the name

Throws:
NamedObjectException
ObjectNotLoadedException

getNames

public java.lang.String[] getNames()
Get all the names of the named objects


writeSerializedData

public void writeSerializedData(java.io.DataOutput dataOutput,
                                java.io.Serializable userData)
                         throws java.io.IOException
Write a serializable object to the current file position, proceeded by the size of the object

Throws:
java.io.IOException

readSerializedData

public java.lang.Object readSerializedData(java.io.DataInput dataInput)
                                    throws java.io.IOException
Throws:
java.io.IOException

skipUserData

public void skipUserData(java.io.DataInput dataInput)
                  throws java.io.IOException
Skip past the user data object

Throws:
java.io.IOException

writeColor3f

public void writeColor3f(java.io.DataOutput out,
                         javax.vecmath.Color3f color)
                  throws java.io.IOException
Throws:
java.io.IOException

readColor3f

public javax.vecmath.Color3f readColor3f(java.io.DataInput in)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeColor4f

public void writeColor4f(java.io.DataOutput out,
                         javax.vecmath.Color4f vec)
                  throws java.io.IOException
Throws:
java.io.IOException

readColor4f

public javax.vecmath.Color4f readColor4f(java.io.DataInput in)
                                  throws java.io.IOException
Throws:
java.io.IOException

writePoint3f

public void writePoint3f(java.io.DataOutput out,
                         javax.vecmath.Point3f pt)
                  throws java.io.IOException
Throws:
java.io.IOException

readPoint3f

public javax.vecmath.Point3f readPoint3f(java.io.DataInput in)
                                  throws java.io.IOException
Throws:
java.io.IOException

writePoint3d

public void writePoint3d(java.io.DataOutput out,
                         javax.vecmath.Point3d pt)
                  throws java.io.IOException
Throws:
java.io.IOException

readPoint3d

public javax.vecmath.Point3d readPoint3d(java.io.DataInput in)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeVector3f

public void writeVector3f(java.io.DataOutput out,
                          javax.vecmath.Vector3f vec)
                   throws java.io.IOException
Throws:
java.io.IOException

readVector3f

public javax.vecmath.Vector3f readVector3f(java.io.DataInput in)
                                    throws java.io.IOException
Throws:
java.io.IOException

writeVector4d

public void writeVector4d(java.io.DataOutput out,
                          javax.vecmath.Vector4d vec)
                   throws java.io.IOException
Throws:
java.io.IOException

readVector4d

public javax.vecmath.Vector4d readVector4d(java.io.DataInput in)
                                    throws java.io.IOException
Throws:
java.io.IOException

writeVector4f

public void writeVector4f(java.io.DataOutput out,
                          javax.vecmath.Vector4f vec)
                   throws java.io.IOException
Throws:
java.io.IOException

readVector4f

public javax.vecmath.Vector4f readVector4f(java.io.DataInput in)
                                    throws java.io.IOException
Throws:
java.io.IOException

writeQuat4f

public void writeQuat4f(java.io.DataOutput out,
                        javax.vecmath.Quat4f vec)
                 throws java.io.IOException
Throws:
java.io.IOException

readQuat4f

public javax.vecmath.Quat4f readQuat4f(java.io.DataInput in)
                                throws java.io.IOException
Throws:
java.io.IOException

writeMatrix4d

public void writeMatrix4d(java.io.DataOutput out,
                          javax.vecmath.Matrix4d m)
                   throws java.io.IOException
Throws:
java.io.IOException

readMatrix4d

public javax.vecmath.Matrix4d readMatrix4d(java.io.DataInput in)
                                    throws java.io.IOException
Throws:
java.io.IOException

writeTuple3f

public void writeTuple3f(java.io.DataOutput out,
                         javax.vecmath.Tuple3f tuple)
                  throws java.io.IOException
Throws:
java.io.IOException

readTuple3f

public javax.vecmath.Tuple3f readTuple3f(java.io.DataInput in,
                                         javax.vecmath.Tuple3f tuple)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeTuple3d

public void writeTuple3d(java.io.DataOutput out,
                         javax.vecmath.Tuple3d tuple)
                  throws java.io.IOException
Throws:
java.io.IOException

readTuple3d

public javax.vecmath.Tuple3d readTuple3d(java.io.DataInput in,
                                         javax.vecmath.Tuple3d tuple)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeTuple4d

public void writeTuple4d(java.io.DataOutput out,
                         javax.vecmath.Tuple4d tuple)
                  throws java.io.IOException
Throws:
java.io.IOException

readTuple4d

public javax.vecmath.Tuple4d readTuple4d(java.io.DataInput in,
                                         javax.vecmath.Tuple4d tuple)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeTuple4f

public void writeTuple4f(java.io.DataOutput out,
                         javax.vecmath.Tuple4f tuple)
                  throws java.io.IOException
Throws:
java.io.IOException

readTuple4f

public javax.vecmath.Tuple4f readTuple4f(java.io.DataInput in,
                                         javax.vecmath.Tuple4f tuple)
                                  throws java.io.IOException
Throws:
java.io.IOException

writeTransform3D

public void writeTransform3D(java.io.DataOutput out,
                             javax.media.j3d.Transform3D tran)
                      throws java.io.IOException
Throws:
java.io.IOException

readTransform3D

public javax.media.j3d.Transform3D readTransform3D(java.io.DataInput in)
                                            throws java.io.IOException
Throws:
java.io.IOException

writeBounds

public void writeBounds(java.io.DataOutput out,
                        javax.media.j3d.Bounds bounds)
                 throws java.io.IOException
Throws:
java.io.IOException

readBounds

public javax.media.j3d.Bounds readBounds(java.io.DataInput in)
                                  throws java.io.IOException
Throws:
java.io.IOException

getFilePointer

public abstract long getFilePointer()
Get the current file 'pointer' location.


close

public abstract void close()
                    throws java.io.IOException
Throws:
java.io.IOException

useSuperClassIfNoChildClass

public boolean useSuperClassIfNoChildClass()
Indicates to SceneGraphObjectState that it should use the Java3D core superclass for any tree nodes whose classes are not in the classpath during a load.


getImageCompression

public int getImageCompression()
Returns the imageCompression to be used IMAGE_COMPRESSION_NONE, IMAGE_COMPRESSION_GZIP, IMAGE_COMPRESSION_JPEG