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 classStream.Link
-
Field Summary
Fields Modifier and Type Field Description protected java.io.ByteArrayInputStreamm_acBufferprotected java.io.ByteArrayOutputStreamm_acBufferOutprotected java.io.DataInputStreamm_acDataInprotected java.io.DataOutputStreamm_acDataOutprotected java.util.Vector<GraphicsObject>m_apkTopLeveltop level object storageprotected intm_iBufferNextread/write always applied to buffer in memoryprotected intm_iBufferSizeread/write always applied to buffer in memoryprotected java.util.Hashtable<java.lang.Integer,Stream.Link>m_kMapregistration of objects on Saveprotected java.util.Vector<GraphicsObject>m_kOrderedFor saving objects in depth-first order.protected StreamVersionm_kVersionversion of last loaded fileprotected static java.lang.Stringms_acTopLevelstatic intSIZEOF_BOOLEANstatic intSIZEOF_BYTEstatic intSIZEOF_FLOATstatic intSIZEOF_INT
-
Constructor Summary
Constructors Constructor Description Stream()construction
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()destructionintGetBufferNext()intGetBufferSize()intGetDiskUsed()support for disk usageGraphicsObjectGetFromMap(java.lang.Integer iID)GraphicsObjectGetObjectAt(int i)Return the object at position i on the list.intGetObjectCount()Return the number of objects one the list of objects to process.GraphicsObjectGetOrderedObject(int i)Access the array of unique objects, ordered by time of visitation in the Register traversal.intGetOrderedQuantity()Access the array of unique objects, ordered by time of visitation in the Register traversal.StreamVersionGetVersion()The version of the last loaded file from disk.booleanInsert(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 booleanInsertInMap(java.lang.Integer iID, Stream.Link pkLink)protected voidInsertInOrdered(GraphicsObject pkObject)booleanIsTopLevel(GraphicsObject pkObject)Return true if the object is in the TopLevel listbooleanLoad(java.io.ByteArrayInputStream acBuffer, int iSize)Memory loads and saves.booleanLoad(java.lang.String acFilename)File loads and saves.static java.io.ByteArrayInputStreamLoadFile(java.lang.String acFilename)File loads and saves.voidRead(boolean[] rbValue)voidRead(float[] rfValue)voidRead(int[] riValue)voidRead(int iQuantity, byte[] aucValue)voidRead(int iQuantity, float[] afValue)voidRead(int iQuantity, int[] aiValue)voidRead(int iQuantity, ColorRGB[] rkValue)voidRead(int iQuantity, ColorRGBA[] rkValue)voidRead(ColorRGB rkValue)voidRead(ColorRGBA rkValue)voidRead(Matrix3f rkValue)voidRead(Plane3f rkValue)voidRead(Vector3f rkValue)voidRead(Transformation rkValue)booleanReadBoolean()floatReadFloat()intReadInt()java.lang.StringReadString()booleanRemove(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.voidRemoveAll()Remove all objects from the list of objects to process.byte[]Save(int[] riSize)Memory loads and saves.booleanSave(java.lang.String acFilename)File loads and saves.booleanSaveText(java.lang.String acFilename, int iTabSize)file save (ASCII text)voidWrite(boolean bValue)voidWrite(float fValue)voidWrite(int iValue)voidWrite(int iQuantity, byte[] aucValue)voidWrite(int iQuantity, float[] afValue)voidWrite(int iQuantity, int[] aiValue)voidWrite(int iQuantity, ColorRGB[] rkValue)voidWrite(int iQuantity, ColorRGBA[] rkValue)voidWrite(java.lang.String rkValue)voidWrite(ColorRGB rkValue)voidWrite(ColorRGBA rkValue)voidWrite(Matrix3f rkValue)voidWrite(Plane3f rkValue)voidWrite(Vector3f rkValue)voidWrite(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)
-
-