Class SceneGraphStreamWriter
- java.lang.Object
-
- com.sun.j3d.utils.scenegraph.io.SceneGraphStreamWriter
-
public class SceneGraphStreamWriter extends java.lang.ObjectWrites a Java3D SceneGraph to a Java OutputStream.Using this class to write to a FileOutputStream is not recommended. Use SceneGraphFileWriter instead to achieve maximum performance and flexibility.
-
-
Constructor Summary
Constructors Constructor Description SceneGraphStreamWriter(java.io.OutputStream outputStream)Creates new SceneGraphStreamWriter that will write to the supplied stream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the SceneGraphStreamWriter and the associated streamvoidwriteBranchGraph(BranchGroup graph, java.util.HashMap namedObjects)Write the entire graph to the stream.voidwriteUniverse(SimpleUniverse universe, boolean writeContent)Writeuniverseto the Stream.
-
-
-
Method Detail
-
writeUniverse
public void writeUniverse(SimpleUniverse universe, boolean writeContent) throws java.io.IOException, UnsupportedUniverseException
Writeuniverseto the Stream.If
writeContentis true then all BranchGraphs attached to the universe will be saved. If it is false then only the universe data structures will be output (PlatformGeometry, ViewerAvatar, Locales, and the MultiTransformGroup between the ViewingPlatform and the View).If
writeContentis true then all the BranchGraphs attached to the Locales of the universe must have the ALLOW_DETACH capability set. If they do not, aCapabilityNotSetExceptionwill be thrown- Parameters:
universe- The universe to writewriteContent- Flag enabling the BranchGraphs to be written- Throws:
java.io.IOExceptionUnsupportedUniverseException- Thrown if the universe class is not supported by this implementation
-
writeBranchGraph
public void writeBranchGraph(BranchGroup graph, java.util.HashMap namedObjects) throws java.io.IOException, DanglingReferenceException, NamedObjectException
Write the entire graph to the stream.The API will correctly handle NodeComponents that are shared between seperate graphs. However Nodes cannot be referenced in other Graphs.
If a reference to a Node in another graph is encountered a DanglingReferenceException will be thrown.
namedObjectscan contain a mapping between a key and a SceneGraphObject in the graph. During the read process this can be used to locate nodes in the graph.- Throws:
java.io.IOExceptionDanglingReferenceExceptionNamedObjectException
-
close
public void close() throws java.io.IOExceptionClose the SceneGraphStreamWriter and the associated stream- Throws:
java.io.IOException
-
-