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

java.lang.Object
  extended by com.sun.j3d.utils.scenegraph.io.retained.Controller
      extended by com.sun.j3d.utils.scenegraph.io.retained.RandomAccessFileControl

public class RandomAccessFileControl
extends Controller


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.j3d.utils.scenegraph.io.retained.Controller
Controller.J3dIOObjectInputStream
 
Field Summary
private  int branchGraphCount
           
protected  java.lang.String FILE_IDENT
           
private  java.io.RandomAccessFile raf
           
private  long symbol_table
           
private  long universe_config
           
private  long user_data
           
private  java.lang.Object userData
           
private  boolean writeMode
           
 
Fields inherited from class com.sun.j3d.utils.scenegraph.io.retained.Controller
BG_DIR_PTR, BRANCH_GRAPH_COUNT, classLoader, currentFileVersion, FILE_DESCRIPTION, j3dClasses, NAMES_OBJECTS_TABLE_PTR, NODE_TYPES_PTR, nullObject, outputFileVersion, SYMBOL_TABLE_PTR, symbolTable, UNIVERSE_CONFIG_PTR
 
Constructor Summary
RandomAccessFileControl()
          Creates new RandomAccessFileControl
 
Method Summary
 void close()
           
 void createFile(java.io.File file, SimpleUniverse universe, boolean writeUniverseContent, java.lang.String description, java.io.Serializable userData)
          Create the file and write the inital header information
 int getBranchGraphCount()
          Return the number of branchgraphs in the file
 int getBranchGraphPosition(BranchGroup graph)
          Given a branchgraph, return the corresponding index of the graph in the file.
 long getFilePointer()
          Get the current file 'pointer' location.
 java.lang.Object getUserData()
           
 void loadNodeComponent(SymbolTableData symbol)
          Used by SymbolTable to load a node component that is not in current graph
 void loadSharedGroup(SymbolTableData symbol)
          Loads the specified SharedGroup
 void openFile(java.io.File file)
          Open the file for reading
 BranchGroup[] readAllBranchGraphs()
          Read and return all the graphs in the file
 BranchGroup[] readBranchGraph(int graphID)
           
protected  void readBranchGraphs(int[] graphs)
          Read the set of branchgraps.
 java.lang.Object readBranchGraphUserData(int graphID)
           
 java.lang.String readFileDescription()
           
private  BranchGroupState readNextBranchGraph()
          Read the next userData and BranchGraph structure in the file at the current position
protected  void readNodeComponents(java.io.DataInput in)
          Read in all the node components in this block
private  BranchGroupState readSingleBranchGraph(int graphID)
          Read the specified branchgraph but do NOT call buildGraph
 ConfiguredUniverse readUniverse(boolean attachBranchGraphs, Canvas3D canvas)
           
 void writeBranchGraph(BranchGroup bg, java.io.Serializable userData)
           
private  void writeClose()
          Write all the pointers etc
protected  void writeNodeComponents(java.io.DataOutput out)
          Write all the unsaved NodeComponents and SharedGroups to DataOutput.
 void writeObject(java.io.DataOutput out, SceneGraphObjectState obj)
           
 
Methods inherited from class com.sun.j3d.utils.scenegraph.io.retained.Controller
addNamedObject, createState, createState, createState, getClassLoader, getCurrentFileVersion, getImageCompression, getNamedObject, getNames, getNodeClassFromID, getNodeClassID, getOutputFileVersion, getSymbolTable, readBounds, readColor3f, readColor4f, readMatrix4d, readObject, readPoint3d, readPoint3f, readQuat4f, readSerializedData, readSharedGroup, readTransform3D, readTuple3d, readTuple3f, readTuple4d, readTuple4f, readUniverse, readVector3f, readVector4d, readVector4f, reset, setClassLoader, skipUserData, useSuperClassIfNoChildClass, writeBounds, writeColor3f, writeColor4f, writeMatrix4d, writePoint3d, writePoint3f, writeQuat4f, writeSerializedData, writeSharedGroup, writeTransform3D, writeTuple3d, writeTuple3f, writeTuple4d, writeTuple4f, writeUniverse, writeVector3f, writeVector4d, writeVector4f
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_IDENT

protected java.lang.String FILE_IDENT

user_data

private long user_data

universe_config

private long universe_config

symbol_table

private long symbol_table

raf

private java.io.RandomAccessFile raf

branchGraphCount

private int branchGraphCount

writeMode

private boolean writeMode

userData

private java.lang.Object userData
Constructor Detail

RandomAccessFileControl

public RandomAccessFileControl()
Creates new RandomAccessFileControl

Method Detail

createFile

public void createFile(java.io.File file,
                       SimpleUniverse universe,
                       boolean writeUniverseContent,
                       java.lang.String description,
                       java.io.Serializable userData)
                throws java.io.IOException,
                       UnsupportedUniverseException,
                       CapabilityNotSetException
Create the file and write the inital header information

Throws:
java.io.IOException
UnsupportedUniverseException
CapabilityNotSetException

openFile

public void openFile(java.io.File file)
              throws java.io.IOException
Open the file for reading

Throws:
java.io.IOException

readUniverse

public ConfiguredUniverse readUniverse(boolean attachBranchGraphs,
                                       Canvas3D canvas)
                                throws java.io.IOException
Throws:
java.io.IOException

getUserData

public java.lang.Object getUserData()

readBranchGraphs

protected void readBranchGraphs(int[] graphs)
                         throws java.io.IOException
Read the set of branchgraps. Used by readUniverse RandomAccessFileControl will read the graphs in the array, StreamControl will read all graphs in the stream

Specified by:
readBranchGraphs in class Controller
Throws:
java.io.IOException

getBranchGraphCount

public int getBranchGraphCount()
Return the number of branchgraphs in the file


writeBranchGraph

public void writeBranchGraph(BranchGroup bg,
                             java.io.Serializable userData)
                      throws java.io.IOException
Specified by:
writeBranchGraph in class Controller
Throws:
java.io.IOException

readBranchGraph

public BranchGroup[] readBranchGraph(int graphID)
                              throws java.io.IOException
Throws:
java.io.IOException

readAllBranchGraphs

public BranchGroup[] readAllBranchGraphs()
                                  throws java.io.IOException
Read and return all the graphs in the file

Throws:
java.io.IOException

readSingleBranchGraph

private BranchGroupState readSingleBranchGraph(int graphID)
                                        throws java.io.IOException
Read the specified branchgraph but do NOT call buildGraph

Throws:
java.io.IOException

readNextBranchGraph

private BranchGroupState readNextBranchGraph()
                                      throws java.io.IOException
Read the next userData and BranchGraph structure in the file at the current position

Throws:
java.io.IOException

readBranchGraphUserData

public java.lang.Object readBranchGraphUserData(int graphID)
                                         throws java.io.IOException
Throws:
java.io.IOException

writeNodeComponents

protected void writeNodeComponents(java.io.DataOutput out)
                            throws java.io.IOException
Write all the unsaved NodeComponents and SharedGroups to DataOutput. Mark all the NodeComponents as saved.

Overrides:
writeNodeComponents in class Controller
Throws:
java.io.IOException

readNodeComponents

protected void readNodeComponents(java.io.DataInput in)
                           throws java.io.IOException
Read in all the node components in this block

Overrides:
readNodeComponents in class Controller
Throws:
java.io.IOException

writeObject

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

readFileDescription

public java.lang.String readFileDescription()
                                     throws java.io.IOException
Throws:
java.io.IOException

loadNodeComponent

public void loadNodeComponent(SymbolTableData symbol)
                       throws java.io.IOException
Used by SymbolTable to load a node component that is not in current graph

Throws:
java.io.IOException

loadSharedGroup

public void loadSharedGroup(SymbolTableData symbol)
                     throws java.io.IOException
Loads the specified SharedGroup

Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in class Controller
Throws:
java.io.IOException

writeClose

private void writeClose()
                 throws java.io.IOException
Write all the pointers etc

Throws:
java.io.IOException

getFilePointer

public long getFilePointer()
Description copied from class: Controller
Get the current file 'pointer' location.

Specified by:
getFilePointer in class Controller

getBranchGraphPosition

public int getBranchGraphPosition(BranchGroup graph)
Given a branchgraph, return the corresponding index of the graph in the file. Returns -1 if graph not found.



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