# Class SceneGraphStreamReader

java.lang.Object
com.sun.j3d.utils.scenegraph.io.SceneGraphStreamReader

public class SceneGraphStreamReader extends Object
Read and create a (set) of Java3D BranchGraphs or Universe from a Java Stream.

## Constructor Summary

Constructors
Constructor
Description
`SceneGraphStreamReader(InputStream stream)`
Creates new SceneGraphStreamReader and reads the file header information

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close the SceneGraphStreamReader stream
`ClassLoader`
`getClassLoader()`
Get the ClassLoader used to load the scene graph objects and deserialize user data
`BranchGroup`
`readBranchGraph(HashMap namedObjects)`
Read and return the graph from the stream.
`ConfiguredUniverse`
`readUniverse()`
Read and create the universe.
`ConfiguredUniverse`
`readUniverse(Canvas3D canvas)`
Read and create the universe.
`void`
`setClassLoader(ClassLoader classLoader)`
Set the ClassLoader used to load the scene graph objects and deserialize user data

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SceneGraphStreamReader

public SceneGraphStreamReader(InputStream stream) throws IOException
Creates new SceneGraphStreamReader and reads the file header information

Throws:
  `IOException`

## Method Details

### readUniverse

public ConfiguredUniverse readUniverse() throws IOException
Read and create the universe. If the BranchGraphs were written then they will be added to the universe before it is returned.

Throws:
  `IOException`

### readUniverse

public ConfiguredUniverse readUniverse(Canvas3D canvas) throws IOException
Read and create the universe. If the BranchGraphs were written then they will be added to the universe before it is returned.

Parameters:
  `canvas` - The Canvas3D to associate with the universe.
Throws:
  `IOException`

### readBranchGraph

public BranchGroup readBranchGraph(HashMap namedObjects) throws IOException
Read and return the graph from the stream. `namedObjects` map will be updated with any objects that were named during the write process

Throws:
  `IOException`

### setClassLoader

public void setClassLoader(ClassLoader classLoader)
Set the ClassLoader used to load the scene graph objects and deserialize user data

### getClassLoader

public ClassLoader getClassLoader()
Get the ClassLoader used to load the scene graph objects and deserialize user data

### close

public void close() throws IOException
Close the SceneGraphStreamReader stream

Throws:
  `IOException`
Since:
  Java 3D 1.5.1