public class SceneGraphStreamWriter extends Object
Using this class to write to a FileOutputStream is not recommended. Use SceneGraphFileWriter instead to achieve maximum performance and flexibility.
Constructor and Description |
---|
SceneGraphStreamWriter(OutputStream outputStream)
Creates new SceneGraphStreamWriter that will write to the supplied stream
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the SceneGraphStreamWriter and the associated stream
|
void |
writeBranchGraph(BranchGroup graph,
HashMap namedObjects)
Write the entire graph to the stream.
|
void |
writeUniverse(SimpleUniverse universe,
boolean writeContent)
Write
universe to the Stream. |
public SceneGraphStreamWriter(OutputStream outputStream) throws IOException
IOException
public void writeUniverse(SimpleUniverse universe, boolean writeContent) throws IOException, UnsupportedUniverseException
universe
to the Stream.
If writeContent
is 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 writeContent
is true then all the BranchGraphs
attached to the Locales of the universe must have the
ALLOW_DETACH capability set. If they do not, a CapabilityNotSetException
will be thrown
universe
- The universe to writewriteContent
- Flag enabling the BranchGraphs to be writtenIOException
UnsupportedUniverseException
- Thrown if the universe class is not
supported by this implementationpublic void writeBranchGraph(BranchGroup graph, HashMap namedObjects) throws IOException, DanglingReferenceException, NamedObjectException
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.
namedObjects
can 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.
public void close() throws IOException
IOException
Copyright © 2016–2022 SciJava. All rights reserved.