Class Stream


  • public class Stream
    extends java.lang.Object
    • 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
    • Constructor Detail

      • Stream

        public Stream()
        construction
    • 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 load
        iSize - 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​(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 write
        iTabSize - 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​(Vector3f rkValue)
      • InsertInMap

        protected boolean InsertInMap​(java.lang.Integer iID,
                                      Stream.Link pkLink)
      • InsertInOrdered

        protected void InsertInOrdered​(GraphicsObject pkObject)