Class Stream
- java.lang.Object
-
- WildMagic.LibGraphics.ObjectSystem.Stream
-
public class Stream extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
Stream.Link
-
Field Summary
Fields Modifier and Type Field Description protected java.io.ByteArrayInputStream
m_acBuffer
protected java.io.ByteArrayOutputStream
m_acBufferOut
protected java.io.DataInputStream
m_acDataIn
protected java.io.DataOutputStream
m_acDataOut
protected java.util.Vector<GraphicsObject>
m_apkTopLevel
top level object storageprotected int
m_iBufferNext
read/write always applied to buffer in memoryprotected int
m_iBufferSize
read/write always applied to buffer in memoryprotected java.util.Hashtable<java.lang.Integer,Stream.Link>
m_kMap
registration of objects on Saveprotected java.util.Vector<GraphicsObject>
m_kOrdered
For saving objects in depth-first order.protected StreamVersion
m_kVersion
version of last loaded fileprotected static java.lang.String
ms_acTopLevel
static int
SIZEOF_BOOLEAN
static int
SIZEOF_BYTE
static int
SIZEOF_FLOAT
static int
SIZEOF_INT
-
Constructor Summary
Constructors Constructor Description Stream()
construction
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
destructionint
GetBufferNext()
int
GetBufferSize()
int
GetDiskUsed()
support for disk usageGraphicsObject
GetFromMap(java.lang.Integer iID)
GraphicsObject
GetObjectAt(int i)
Return the object at position i on the list.int
GetObjectCount()
Return the number of objects one the list of objects to process.GraphicsObject
GetOrderedObject(int i)
Access the array of unique objects, ordered by time of visitation in the Register traversal.int
GetOrderedQuantity()
Access the array of unique objects, ordered by time of visitation in the Register traversal.StreamVersion
GetVersion()
The version of the last loaded file from disk.boolean
Insert(GraphicsObject pkObject)
Add an object to the list of objects to process, each object representing an entry into a connected component of the abstract graph.protected boolean
InsertInMap(java.lang.Integer iID, Stream.Link pkLink)
protected void
InsertInOrdered(GraphicsObject pkObject)
boolean
IsTopLevel(GraphicsObject pkObject)
Return true if the object is in the TopLevel listboolean
Load(java.io.ByteArrayInputStream acBuffer, int iSize)
Memory loads and saves.boolean
Load(java.lang.String acFilename)
File loads and saves.static java.io.ByteArrayInputStream
LoadFile(java.lang.String acFilename)
File loads and saves.void
Read(boolean[] rbValue)
void
Read(float[] rfValue)
void
Read(int[] riValue)
void
Read(int iQuantity, byte[] aucValue)
void
Read(int iQuantity, float[] afValue)
void
Read(int iQuantity, int[] aiValue)
void
Read(int iQuantity, ColorRGB[] rkValue)
void
Read(int iQuantity, ColorRGBA[] rkValue)
void
Read(ColorRGB rkValue)
void
Read(ColorRGBA rkValue)
void
Read(Matrix3f rkValue)
void
Read(Plane3f rkValue)
void
Read(Vector3f rkValue)
void
Read(Transformation rkValue)
boolean
ReadBoolean()
float
ReadFloat()
int
ReadInt()
java.lang.String
ReadString()
boolean
Remove(GraphicsObject pkObject)
Remove an object from the list of objects to process, each object representing an entry into a connected component of the abstract graph.void
RemoveAll()
Remove all objects from the list of objects to process.byte[]
Save(int[] riSize)
Memory loads and saves.boolean
Save(java.lang.String acFilename)
File loads and saves.boolean
SaveText(java.lang.String acFilename, int iTabSize)
file save (ASCII text)void
Write(boolean bValue)
void
Write(float fValue)
void
Write(int iValue)
void
Write(int iQuantity, byte[] aucValue)
void
Write(int iQuantity, float[] afValue)
void
Write(int iQuantity, int[] aiValue)
void
Write(int iQuantity, ColorRGB[] rkValue)
void
Write(int iQuantity, ColorRGBA[] rkValue)
void
Write(java.lang.String rkValue)
void
Write(ColorRGB rkValue)
void
Write(ColorRGBA rkValue)
void
Write(Matrix3f rkValue)
void
Write(Plane3f rkValue)
void
Write(Vector3f rkValue)
void
Write(Transformation rkValue)
-
-
-
Field Detail
-
SIZEOF_INT
public static int SIZEOF_INT
-
SIZEOF_FLOAT
public static int SIZEOF_FLOAT
-
SIZEOF_BOOLEAN
public static int SIZEOF_BOOLEAN
-
SIZEOF_BYTE
public static int SIZEOF_BYTE
-
m_kVersion
protected StreamVersion m_kVersion
version of last loaded file
-
m_apkTopLevel
protected java.util.Vector<GraphicsObject> m_apkTopLevel
top level object storage
-
m_kMap
protected java.util.Hashtable<java.lang.Integer,Stream.Link> m_kMap
registration of objects on Save
-
m_kOrdered
protected java.util.Vector<GraphicsObject> m_kOrdered
For saving objects in depth-first order. If instead the objects are saved based on hash-table order (in m_kMap), then the order of objects for a scene graph can change between different runs of a program since the memory addresses for the objects can change between runs.
-
m_iBufferSize
protected int m_iBufferSize
read/write always applied to buffer in memory
-
m_iBufferNext
protected int m_iBufferNext
read/write always applied to buffer in memory
-
m_acBuffer
protected java.io.ByteArrayInputStream m_acBuffer
-
m_acBufferOut
protected java.io.ByteArrayOutputStream m_acBufferOut
-
m_acDataOut
protected java.io.DataOutputStream m_acDataOut
-
m_acDataIn
protected java.io.DataInputStream m_acDataIn
-
ms_acTopLevel
protected static final java.lang.String ms_acTopLevel
-
-
Method Detail
-
LoadFile
public static java.io.ByteArrayInputStream LoadFile(java.lang.String acFilename)
File loads and saves. Load the scene-graph from the file specified- Parameters:
acFilename
- the name of the scene-graph file- Returns:
- a ByteArrayInputStream containing the data.
-
dispose
public void dispose()
destruction
-
GetBufferNext
public int GetBufferNext()
-
GetBufferSize
public int GetBufferSize()
-
GetDiskUsed
public int GetDiskUsed()
support for disk usage- Returns:
- the size of the scene-graph on disk.
-
GetFromMap
public GraphicsObject GetFromMap(java.lang.Integer iID)
-
GetObjectAt
public GraphicsObject GetObjectAt(int i)
Return the object at position i on the list.- Parameters:
i
- the ith object- Returns:
- the object at position i on the list.
-
GetObjectCount
public int GetObjectCount()
Return the number of objects one the list of objects to process.- Returns:
- the number of objects one the list of objects to process.
-
GetOrderedObject
public GraphicsObject GetOrderedObject(int i)
Access the array of unique objects, ordered by time of visitation in the Register traversal. You may use this after a Load or a Save call. If you use it after a Load, changing objects returned by the function GetOrderedObject is valid. If you use it after a Save, changing objects returned by the function will not affect the saved copy, but it will affect the original objects you streamed.- Parameters:
i
- the ith object- Returns:
- the ith object
-
GetOrderedQuantity
public int GetOrderedQuantity()
Access the array of unique objects, ordered by time of visitation in the Register traversal. You may use this after a Load or a Save call. If you use it after a Load, changing objects returned by the function GetOrderedObject is valid. If you use it after a Save, changing objects returned by the function will not affect the saved copy, but it will affect the original objects you streamed.- Returns:
- the number of unique objects.
-
GetVersion
public StreamVersion GetVersion()
The version of the last loaded file from disk. If no file has been loaded, the returned values are -1.- Returns:
- The version of the last loaded file from disk. If no file has been loaded, the returned values are -1.
-
Insert
public boolean Insert(GraphicsObject pkObject)
Add an object to the list of objects to process, each object representing an entry into a connected component of the abstract graph.- Parameters:
pkObject
- the objects to process- Returns:
- true if the object is inserted into the list, false if already inserted
-
IsTopLevel
public boolean IsTopLevel(GraphicsObject pkObject)
Return true if the object is in the TopLevel list- Parameters:
pkObject
- the object to check- Returns:
- true if the object is in the TopLevel list, false otherwise.
-
Load
public boolean Load(java.io.ByteArrayInputStream acBuffer, int iSize)
Memory loads and saves. Stream does not assume responsibility for the char arrays. The application must manage the input acBuffer for the call to Load and delete the output racBuffer for the call to Save.- Parameters:
acBuffer
- the ByteArrayInputStream storing the data to loadiSize
- the size of the ByteArrayInputStream storing the data to load- Returns:
- true if sucess, false on failure.
-
Load
public boolean Load(java.lang.String acFilename)
File loads and saves. Load the scene-graph from the file specified- Parameters:
acFilename
- the name of the scene-graph file- Returns:
- true on sucess, false on failure.
-
Read
public void Read(boolean[] rbValue)
-
Read
public void Read(ColorRGB rkValue)
-
Read
public void Read(ColorRGBA rkValue)
-
Read
public void Read(float[] rfValue)
-
Read
public void Read(int iQuantity, byte[] aucValue)
-
Read
public void Read(int iQuantity, ColorRGB[] rkValue)
-
Read
public void Read(int iQuantity, ColorRGBA[] rkValue)
-
Read
public void Read(int iQuantity, float[] afValue)
-
Read
public void Read(int iQuantity, int[] aiValue)
-
Read
public void Read(int[] riValue)
-
Read
public void Read(Matrix3f rkValue)
-
Read
public void Read(Plane3f rkValue)
-
Read
public void Read(Transformation rkValue)
-
Read
public void Read(Vector3f rkValue)
-
ReadBoolean
public boolean ReadBoolean()
-
ReadFloat
public float ReadFloat()
-
ReadInt
public int ReadInt()
-
ReadString
public java.lang.String ReadString()
-
Remove
public boolean Remove(GraphicsObject pkObject)
Remove an object from the list of objects to process, each object representing an entry into a connected component of the abstract graph.- Parameters:
pkObject
- the objects to remove- Returns:
- true if the object is removed, false otherwise
-
RemoveAll
public void RemoveAll()
Remove all objects from the list of objects to process.
-
Save
public byte[] Save(int[] riSize)
Memory loads and saves. Stream does not assume responsibility for the char arrays. The application must manage the input acBuffer for the call to Load and delete the output racBuffer for the call to Save.- Parameters:
riSize
- the size of the buffer storing the data to write- Returns:
- byte[] containing the scene-graph data
-
Save
public boolean Save(java.lang.String acFilename)
File loads and saves. Save the scene-graph to the file specified- Parameters:
acFilename
- the name of the scene-graph file- Returns:
- true on sucess, false on failure.
-
SaveText
public boolean SaveText(java.lang.String acFilename, int iTabSize)
file save (ASCII text)- Parameters:
acFilename
- the name of the file to writeiTabSize
- the number of spaces to indent.- Returns:
- true on sucess, false otherwise
-
Write
public void Write(boolean bValue)
-
Write
public void Write(ColorRGB rkValue)
-
Write
public void Write(ColorRGBA rkValue)
-
Write
public void Write(float fValue)
-
Write
public void Write(int iValue)
-
Write
public void Write(int iQuantity, byte[] aucValue)
-
Write
public void Write(int iQuantity, ColorRGB[] rkValue)
-
Write
public void Write(int iQuantity, ColorRGBA[] rkValue)
-
Write
public void Write(int iQuantity, float[] afValue)
-
Write
public void Write(int iQuantity, int[] aiValue)
-
Write
public void Write(Matrix3f rkValue)
-
Write
public void Write(Plane3f rkValue)
-
Write
public void Write(java.lang.String rkValue)
-
Write
public void Write(Transformation rkValue)
-
Write
public void Write(Vector3f rkValue)
-
InsertInMap
protected boolean InsertInMap(java.lang.Integer iID, Stream.Link pkLink)
-
InsertInOrdered
protected void InsertInOrdered(GraphicsObject pkObject)
-
-